numerical error in eig command
Show older comments
If you calculate the eigenvalue of A = [0 1; 0 0], using [Evec, Eval] = eig(A), Matlab will return the answer as:
EVec =
1.0000 -1.0000
0 0.0000
Eval =
0 0
0 0
However this is not correct mathematically. Mathematically, this problem has one eigenvalue Eval = 0 and one eigenvector Evec = [1 0]. The calculated eigenvectors by Matlab are not independent eigenvectors as Evec(:,1) = -Evec(:,2).
If you print the data with longer format, "format longe", the answer is :
EVec =
1.000000000000000e+00 -1.000000000000000e+00
0 2.004168360008973e-292
Eval =
0 0
0 0
It seems that because of the numerical error, Matlab assumes Evec(:,1) and Evec(:,2) as two independent eigenvector! Anyway, this is numerical error.
How could you make sure that in your code where the eigenvalue problem on a matrix with many zeros is the central bit, Matlab does not compute the eigenvectors and eigenvalues incorrectly due to the numerical error?
Accepted Answer
More Answers (0)
Categories
Find more on Linear Algebra 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!