How to seperate complex numbers based on imaginary values.

Hi, I am using eig(A) to find eigen values of a 8x8 matrix. There are 8 eigen values for the matrix. But only four of them are complex numbers while the other four are pure real numbers. I need only the values with imaginary parts for my further computations. How do I seperate them? Thanks.

 Accepted Answer

K = rand(8) ;
E = eig(K) ;
E = E(imag(E) ~= 0);
Note, though, that eigenvalues should be entirely real can end up with a small imaginary component due to round-off error. You might want to use something like
tolerance = 1e-10;
E = E( abs(imag(E)) <= tolerance );

More Answers (0)

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!