what is method inside roots in matlab
Show older comments
to slove x*3-2x-5 using method inside roots
Answers (1)
Torsten
on 18 Feb 2015
From the documentation:
The algorithm simply involves computing the eigenvalues of the companion matrix:
A = diag(ones(n-1,1),-1);
A(1,:) = -c(2:n+1)./c(1);
eig(A)
It is possible to prove that the results produced are the exact eigenvalues of a matrix within roundoff error of the companion matrix A, but this does not mean that they are the exact roots of a polynomial with coefficients within roundoff error of those in c.
Best wishes
Torsten.
2 Comments
puttgunta yaswanth
on 18 Feb 2015
Torsten
on 18 Feb 2015
Why not ?
c(1)=1;
c(2)=0;
c(3)=-2;
c(4)=-5;
n=3;
A = diag(ones(n-1,1),-1);
A(1,:) = -c(2:n+1)./c(1);
eig(A)
for your example.
Best wishes
Torsten.
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!