Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

1 回表示 (過去 30 日間)
mortain
mortain 2013 年 9 月 6 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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