SOLVING LARGE SYSTEM OF EQUATIONS
Mostrar comentarios más antiguos
Hi, this is my code (the only think that matters is the last line)
a = sym('a',[1 15]);
sym r
p1 = poly2sym(a,r);
diff = sym('diff');
eq = sym('eq');
fprintf('\n polynomial: %s\n', p1);
p2 =poly2sym(a,r);
p2=subs(p2,r,r-1);
%fprintf('\n p2: %s\n', p2);
diff= p1-p2;
%fprintf('\n diff: %s\n', simplify(diff));
diff = coeffs(diff,r);
branch2=prod(r-3:r+5)*(((1/1920)*(r+4)*(r+3)*(r^2+r-10))+((1/5120)*r*(r+1)*(r^2+r-10))+((1/9216)*(r+4)*(r+3)*(r+3)*(r-2)*(r-4)));
%fprintf('\n branch: %s\n', simplify(branch2));
%display(diff);
branch2=coeffs(branch2,r);
for u=1:14
%fprintf('DIFF: %d = %s\n', u, diff(u));
%fprintf('BRANCH: %d = %s\n', u, branch2(u));
eq(u)= diff(u)==branch2(u);
fprintf('EQ %d : %s\n', u, eq(u));
%eqcoef(u)=coeffs(diff(u),[a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14]);
% fprintf('EQCOEF %d : %s\n', u, eqcoef(u));
end
[A,B] = equationsToMatrix([eq(1), eq(2), eq(3),eq(4), eq(5), eq(6),eq(7), eq(8), eq(9),eq(10), eq(11), eq(12),eq(13),eq(14)], [a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14]);
I would like to solve the system. But this gives me an error that a1 is not defined. But it is. Any help?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Mathematics en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!