not getting left eigen vector
6 views (last 30 days)
Show older comments
Abhinav Kumar
on 5 Oct 2021
Reopened: Walter Roberson
on 5 Oct 2021
Hi,
I have attached the matlab code file
syms z1 z2 z3 z4 z5 z6 z7 ;
A=[z1 z2 z3; z4 z5 z6; 1 2 z7]
M=subs(A,[z1 z2 z3 z4 z5 z6 z7],[-0.1 0.1 -2 0.01 0.07 -0.5 0.2])
[V,D] = eig(M)
[W, ~] = eig(M.')
W'*M - D*W'
The W'*M-D*W' should be equal to or almost zero but that not the case in my coding.
The W'*M-D*W' outputs are like this
ans =
1.0e-14 *
-0.1388 0.5329 0
ans =
1.9774 + 0.1985i 4.0123 - 0.0596i 0.0000 + 3.4528i .(this should be equal to zero)
ans =
1.9774 - 0.1985i 4.0123 + 0.0596i 0.0000 - 3.4528i. (This should be equal to zero)
Is there any different command which I can use for correct left eigen vectors or need any modification
in this command. Please help
0 Comments
Accepted Answer
John D'Errico
on 5 Oct 2021
Edited: John D'Errico
on 5 Oct 2021
If you want the set of left and right eigenvectors, we see in the help for eig...
[V,D,W] = eig(A) also produces a full matrix W whose columns are the
corresponding left eigenvectors so that W'*A = D*W'.
Note this is not the case for the symbolic version of eig. Oh well. But you are converting everything to a double in the end. So why in the name of god and little green apples did you need to start with a symbolic form, and then immediately substiture floating point numbers for all variables?
M = [-0.1, 0.1, -2;...
0.01 , 0.07, -0.5;...
1, 2, 0.2];
[V,D,W] = eig(M)
norm(M*V - V*D)
So zero to within floating point trash. How about the other set of eigenvectors? Eig states this form should hold for the left eigenvectors.
W'*A = D*W'
Does it?
norm(W'*M - D*W')
Again, zero, to within floating point trash.
So what did you do wrong? You computed RIGHT eigenvectors of M'. (M is real, so the .' is irrelevant.) This time I will do it in symbolic form, using the sym/eig code to compute the left eigenvectors.
M
M =
[-1/10, 1/10, -2]
[1/100, 7/100, -1/2]
[ 1, 2, 1/5]
[W,D] = eig(M');
So we must have this be true, for the RIGHT eigenvectors of M'.
M' * W - W * D
But in the form of left eigenvectors of M', we can transpose that, to get
W' * M - D' * W'
Lets try it out.
vpa(W' * M - D' * W',16)
ans =
[ -2.522900868286734e-23, 1.025703959565754e-22, 0]
[- 2.9778502051909e-23 + 3.639594695233322e-23i, 9.926167350636332e-23 - 2.827406731282818e-22i, 0]
[- 2.9778502051909e-23 - 3.639594695233322e-23i, 9.926167350636332e-23 + 2.827406731282818e-22i, 0]
Do you see that is zero, again to within floating point trash?
norm(W' * M - D' * W')
ans =
0
What did you do wrong? You assumed that D' was equal to D.
Is D complex? YES. Was your assumption correct? NO.
More Answers (0)
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!