Info

此问题已关闭。 请重新打开它进行编辑或回答。

Linear System to be solved when the matrix of the coefficients is not defined

1 次查看(过去 30 天)
Hello,
I need to solve a linear system of equations [A]{x}={b} but I don't have the matrix [A]. To be more precise, the equations come from L(x)*M(x)=N(x).
so at the end I end up with a system of linear equations but I cannot really solve it. The equations can be found from the code and the equations to solve are the elements in coeffs from 1 to 5:
clear all
close all
clc
syms x A
N=3; %degree of the polynomial
A=sym('A',[N 1]); a=[];
Q=sym('Q',[N 1]); q=[];
P=sym('P',[N 1]); p=[];
f=cos(sqrt(x)); %function to approximate
Exp_Tay=taylor(f,'Order',2*N-1);
a=sym2poly(Exp_Tay);
a=fliplr(a);
for i=1:2*N-1
l=i-1;
A(i)=a(i)*x^l;
end
for i=1:N
l=i-1;
t=sym(['q' int2str(l)]);
q=[q;t];
Q(i)=q(i)*x^l;
t=sym(['p' int2str(l)]);
p=[p;t];
P(i)=p(i)*x^l;
end
Q(1)=1;
A=sum(A);
Q=sum(Q);
P=sum(P);
Pol=A*Q-P;
coeffs=coeffs(Pol,x);
I need to get the elements of the matrix A from coeffs, before using mldivide
Thanks a lot for any comment.
Antonio

回答(0 个)

此问题已关闭。

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by