eig is not giving a matrix for left eigenvectors
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Samantha Zimmerman
el 8 de Jul. de 2016
Comentada: Walter Roberson
el 8 de Jul. de 2016
I am trying to find the left and right eigenvectors of a 16 by 16 matrix with [V,D,W]=eig( mat ); V, and W are supposed to be matrices where the column vectors are the right and left eigenvectors, and while V meets this, W is a 1 by 16 row vector, W =
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
I haven't included the matrix itself because of its size but I can. Some assistance would be much appreciated.
1 comentario
John D'Errico
el 8 de Jul. de 2016
Why not attach the matrix as a mat file? 16 by 16 is NOT large. In fact, it is trivially tiny.
Respuesta aceptada
Walter Roberson
el 8 de Jul. de 2016
You are using vpa() around a series of rational and floating point values. The end result of vpa() is a symbolic matrix. You are then invoking eig on a symbolic matrix, getting the symbolic eig rather than the numeric eig.
If you want the numeric eig, then skip the vpa() call.
3 comentarios
Walter Roberson
el 8 de Jul. de 2016
Sorry, I do not know how to calculate "right" eigenvectors symbolically.
The routine you are invoking is this one whereas you are instead reading about the numeric one over here
Your array is not going to be high precision the way you have defined it. When you use something like
vpa(A/B)
with numeric constants A and B, then A/B will be calculated in double precision and then the result will be converted to sym(), exactly as if you had done
C = A/B;
vpa(C)
In order to get high precision in a literal array, you need to use, for example,
sym(373535501472003)/sym(175921860444160000)
and even better would be
sym('373535501472003')/sym('175921860444160000')
to avoid the possibility of loss of precision with numbers larger than 2^53. For example, 37353550147200301 cannot be represented exactly in double(), with the closest number being 37353550147200304 .
If your inputs are already class sym() then you do not need to worry about this, but it applies to the sample matrix you posted, which is numeric before you vpa() it.
Más respuestas (1)
John D'Errico
el 8 de Jul. de 2016
It works well enough for me, doing exactly as I would expect on a random matrix.
clear
[V,D,W] = eig(rand(16));
whos
Name Size Bytes Class Attributes
D 16x16 4096 double complex
V 16x16 4096 double complex
W 16x16 4096 double complex
So, if you are getting something completely different, then you need to show clearly what you did. You should attach the matrix as a .mat file to a comment.
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!