Matlab gives different eigenvalue for same matrix
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
why does matlab give me two different eigenvalues for the same matrix? Working for days and found that the source of error is that I get different eigenvalues for same matrix when evaluated in different way and is such that one has even a negative zero(??). I cannot understand the source of error, can anybody help me? below is the code from my work
>> [0.6029;0.0778-0.794*i]
ans =
0.6029
0.0778 - 0.7940i
>> ans*ans'
ans =
0.3635 0.0469 + 0.4787i
0.0469 - 0.4787i 0.6365
>> eig(ans)
ans =
0.0000
1.0000
>> A(:,:,2) =
0.3635 0.0469 + 0.4787i
0.0469 - 0.4787i 0.6365
>> eig(A(:,:,2))
ans =
-0.0000
1.0000
thanks
3 comentarios
Geoff Hayes
el 26 de Abr. de 2014
What are you initializing A(:,:,2) with? Are you setting it as
A(:,:,2) = ans*ans';
or
A(:,:,2) = [0.3635 0.0469 + 0.4787i
0.0469 - 0.4787i 0.6365 ];
Because the above two assignments are not strictly the same due to the precision of the doubles written to the console.
For example,
>> ans*ans'
ans =
0.3635 0.0469 + 0.4787i
0.0469 - 0.4787i 0.6365
But if I print out more precision to the doubles then we see that:
>> format long g
>> ans*ans'
ans =
0.36348841 + 0i 0.04690562 + 0.4787026i
0.04690562 - 0.4787026i 0.63648884 + 0i
So I think that is reasonable that you are observing two sets of slighty different eigenvalues (note that your 0.0000 and -0.0000 are both small and nearly identical; the use of format long g would probably show more information) since you are inputs are slightly different (one set more precise than the other).
Respuestas (1)
Ver también
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!