Different results in different computers when using the function "eig" to obtain eigenvectors of a matrix

2 visualizaciones (últimos 30 días)
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 ! :)

Respuesta aceptada

Titus Edelhofer
Titus Edelhofer el 24 de Nov. de 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

Más respuestas (0)

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by