not getting left eigen vector

3 views (last 30 days)
Abhinav Kumar
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

Answers (1)

John D'Errico
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)
V =
0.7416 + 0.0000i 0.7416 + 0.0000i 0.8954 + 0.0000i 0.1860 - 0.0199i 0.1860 + 0.0199i -0.4413 + 0.0000i -0.0625 - 0.6412i -0.0625 + 0.6412i -0.0591 + 0.0000i
D =
0.0936 + 1.7264i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0936 - 1.7264i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.0173 + 0.0000i
W =
0.3491 - 0.0403i 0.3491 + 0.0403i 0.2455 + 0.0000i 0.7097 + 0.0000i 0.7097 + 0.0000i -0.9689 + 0.0000i -0.0091 - 0.6106i -0.0091 + 0.6106i 0.0300 + 0.0000i
norm(M*V - V*D)
ans = 1.9481e-15
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')
ans = 9.5794e-16
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.
  1 Comment
Abhinav Kumar
Abhinav Kumar on 5 Oct 2021
Thank you very much for your answer Sir.
Actually, I am estimating the symbols using optimization technique. I substituted the values midway in order to check whether I am going in right direction or not of finding the eigen vectors. It is true by your help.Thank you again.

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!