Get in Order respond when using "eig" command
Show older comments
I am trying to find generalized eigenvalues and eigenvectors of a 12 by 12 system of equations. It is a structural dynamic problem: (K - M*phi)*V = 0 or K*V = M*phi*V
In this case, "phi" is the eigenvalue (natural frequency square) matrix and "V" is the eigenvector (mode shapes) matrix.
To find eigenpairs in MATLAB, I use the command [V,phi] = eig(K,M). This produces the two matrices for me but the problem is that they are not in order.
It is known that the first eigenvalue is the lowest and it will increase for the higher mode shapes. However, the response I get is not in any order. My problem is a 12 by 12, and the first 5 eigenvalues are decreasing and it will increase. I'm not sure what it means, and how can I get the result in the normal order, such that the first column contains the lowest eigenvalue and the rest will be increasing. Following are K and M matrices I use.
Thank you so much for your time and considerations.
k = [0.100000E+01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00;0.000000E+00 0.100000E+01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00;0.000000E+00 0.000000E+00 0.175087E+04 -0.324091E+03 -0.833333E+02 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -0.412479E+03 0.412479E+03;0.000000E+00 0.000000E+00 -0.324091E+03 0.584201E+03 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -0.833333E+02 0.412479E+03 -0.412479E+03;0.000000E+00 0.000000E+00 -0.833333E+02 0.000000E+00 0.112796E+03 0.294628E+02 0.000000E+00 0.000000E+00 -0.294628E+02 -0.294628E+02 0.000000E+00 0.000000E+00;0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.294628E+02 0.112796E+03 0.000000E+00 0.000000E+00 -0.294628E+02 -0.294628E+02 0.000000E+00 -0.833333E+02;0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.100000E+01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00; 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 0.100000E+01 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00;0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -0.294628E+02 -0.294628E+02 0.000000E+00 0.000000E+00 0.170624E+04 -0.147314E+03 -0.583333E+03 0.000000E+00;0.000000E+00 0.000000E+00 0.000000E+00 -0.833333E+02 -0.294628E+02 -0.294628E+02 0.000000E+00 0.000000E+00 -0.147314E+03 0.289573E+03 0.000000E+00 0.000000E+00;0.000000E+00 0.000000E+00 -0.412479E+03 0.412479E+03 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -0.583333E+03 0.000000E+00 0.995812E+03 -0.412479E+03;0.000000E+00 0.000000E+00 0.412479E+03 -0.412479E+03 0.000000E+00 -0.833333E+02 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00 -0.412479E+03 0.495812E+03];
m = [0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00;0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00;0.0000E+00 0.0000E+00 0.7118E+02 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00;0.0000E+00 0.0000E+00 0.0000E+00 0.7118E+02 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00; 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.6069E+01 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00;0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.6069E+01 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00;0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00;0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00;0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.5137E+02 0.0000E+00 0.0000E+00 0.0000E+00;0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.5137E+02 0.0000E+00 0.0000E+00;0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.4942E+02 0.0000E+00;0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.4942E+02];
Accepted Answer
More Answers (1)
Steven Lord
on 17 Aug 2018
0 votes
The "Sorted Eigenvalues and Eigenvectors" example on the documentation page for the eig function calls sort with two outputs to sort the eigenvalues (the sorted eigenvalues will be the first output from sort) then uses that second output from sort to reorder the matrix of eigenvectors to match the new order of the eigenvalues.
Categories
Find more on Linear Algebra 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!