Different results in different computers when using the function "eig" to obtain eigenvectors of a matrix
2 views (last 30 days)
Show older comments
Zhe Zhang
on 24 Nov 2015
Answered: Titus Edelhofer
on 24 Nov 2015
The version of matlab in my computer is R2014a, and my friend's version is the same with mine. But when we run the same program, we get different results. We found that the function "eig" produced different results in both computers. The eigenvalues are the same but in different orders. What's more, the corresponding eigenvector of the same eigenvalue is not the same. The attachment includes 3 matrixes. The "D1" is the matrix what we want to get eigenvalues and eigenvectors from. The "D" is the matrix of eigenvalues what we obtain in decreasing order. The "B" is the matrix of eigenvectors corresponding to the eigenvalues. The data of attachment is obtained from my computer. As I said before ,my results are different from results in my friend's computer. So, I want to ask that the data of the attachment is right or wrong? Thanks ! :)
0 Comments
Accepted Answer
Titus Edelhofer
on 24 Nov 2015
Hi Zhe,
keep in mind, that eig quite often sorts the eigenvalues but it does not promise to do so. So having a different ordering is fine. Also keep in mind, that eigenvectors are not unique: they are subject to scaling.
To test, if everything goes fine, is to test, if the result is correct. From the doc:
[V,D] = eig(A) returns matrix V, whose columns are the right eigenvectors of A such that A*V = V*D.
So give it a try, of course you will need to test A*V-V*D being "small".
Titus
0 Comments
More Answers (0)
See Also
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!