Matlab gives different eigenvalue for same matrix
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Geoff Hayes
il 26 Apr 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).
Risposte (1)
Vedere anche
Categorie
Scopri di più su Linear Algebra in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!