Matlab gives different eigenvalue for same matrix
조회 수: 2 (최근 30일)
이전 댓글 표시
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
Geoff Hayes
2014년 4월 26일
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).
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Eigenvalues & Eigenvectors에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!