Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

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

2 visualizaciones (últimos 30 días)
mortain
mortain el 6 de Sept. de 2013
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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

Respuestas (0)

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by