Matlab Eigenvalue/Vector wrong?!

7 vues (au cours des 30 derniers jours)
Meysam Ahmadi
Meysam Ahmadi le 26 Juin 2019
Modifié(e) : John D'Errico le 26 Juin 2019
I am trying to find eigenvalues and vectors of following matrix.
Lsr=[0.0397796877172068 0.0138619531470359 0.0138619531468867 ;
0.0138619531470345 0.0397796877174583 0.0138619531469220;
0.0138619531468881 0.0138619531469388 0.0397796877171021]
[t,el]=eig(Lsr)
But when I reconstruct the matrix with:
X=t*el*t'
I get
X=[0.0403022792872612 0.0124347611687027 0.0147665535551808
0.0124347611687027 0.0406842881257273 0.0143845447169696
0.0147665535551808 0.0143845447169696 0.0383524957387787]
Which is totally off!
Any idea?
  2 commentaires
Walter Roberson
Walter Roberson le 26 Juin 2019
>> Lsr - t*el/t
ans =
0 -5.20417042793042e-18 -3.46944695195361e-18
5.20417042793042e-18 -1.38777878078145e-17 -8.67361737988404e-18
6.93889390390723e-18 3.46944695195361e-18 -6.93889390390723e-18
t' is not expected to be inv(t)
Meysam Ahmadi
Meysam Ahmadi le 26 Juin 2019
Thanks!
I had many many cases working with t' though. That's why never thought this could be the reason!

Connectez-vous pour commenter.

Réponse acceptée

John D'Errico
John D'Errico le 26 Juin 2019
Modifié(e) : John D'Errico le 26 Juin 2019
Um, perhaps you misunderstand what eig does, when the matrix is not the usual, Hermitian symmetric matrix.
Lsr=[0.0397796877172068 0.0138619531470359 0.0138619531468867 ;
0.0138619531470345 0.0397796877174583 0.0138619531469220;
0.0138619531468881 0.0138619531469388 0.0397796877171021];
[V,D] = eig(Lsr);
V =
-0.577350269189232 0.808123905425629 -0.183748102870356
-0.577350269193195 -0.303057917597884 0.780842465815243
-0.577350269186450 -0.505065987828188 -0.597094362953727
D =
0.067503594011158 0 0
0 0.025917734570257 0
0 0 0.025917734570353
Now, do these vectors behave as eigenvalues/eigenvectors? It looks like they do.
>> Lsr*V(:,1) - V(:,1)*D(1,1)
ans =
1.0e-17 *
0
0.693889390390723
0
>> Lsr*V(:,2) - V(:,2)*D(2,2)
ans =
1.0e-16 *
0.069388939039072
0.121430643318376
0.069388939039072
>> Lsr*V(:,3) - V(:,3)*D(3,3)
ans =
1.0e-17 *
-0.346944695195361
-0.693889390390723
-0.346944695195361
So if we multiply the matrix Lsr by an eigenvector, we get the same result, as if we just multiplied that vector by the corresponding eigenvalue. It seems like eig worked. Or did it?
Can you recover Lsr from the form V*D*V'? Well, no. In fact, the matrix Lsr is a defective matrix. This is a common mistake made by people. They assume that all matrices have an eigenvalue decomposition where they can recover the original matrix. But the vectors returned in V are not an orthogonal set.
V'*V
ans =
1.000000000000000 0.000000000000051 0.000000000000348
0.000000000000051 1.000000000000000 -0.083559671916240
0.000000000000348 -0.083559671916240 1.000000000000000
As it turns out, Lsr is not actually a symmetric matrix.
Lsr - Lsr'
ans =
1.0e-13 *
0 0.013999218451133 -0.013999218451133
-0.013999218451133 0 -0.167990621413594
0.013999218451133 0.167990621413594 0
It is close, but not so. We can symmetrize it.
Lsrhat = (Lsr + Lsr')/2;
[Vhat,Dhat] = eig(Lsrhat)
Vhat =
-0.802537691434951 -0.150332699348411 0.577350269189232
0.271076909065118 0.770184377947321 0.577350269193321
0.531460782370591 -0.619851678607487 0.577350269186324
Dhat =
0.025917734570256 0 0
0 0.025917734570353 0
0 0 0.067503594011158
>> Vhat'*Vhat
ans =
1.000000000000000 0.000000000000000 -0.000000000000000
0.000000000000000 1.000000000000000 0.000000000000000
-0.000000000000000 0.000000000000000 1.000000000000000
>> Vhat*Dhat*Vhat' - Lsrhat
ans =
1.0e-16 *
0 0.034694469519536 -0.034694469519536
0.069388939039072 0.346944695195361 -0.017347234759768
-0.034694469519536 -0.052041704279304 0
And now eig is happy. Lsrhat is no longer defective. What is important to see is the tiny change from Lsr to Lsrhat was enough to make a serious change in the eigenvalues and the eigenvectors.
  2 commentaires
Meysam Ahmadi
Meysam Ahmadi le 26 Juin 2019
Thanks John. Well explained!
John D'Errico
John D'Errico le 26 Juin 2019
:)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Linear Algebra dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by