# eig return complex values

6 views (last 30 days)
Michael cohen on 22 Jan 2022
Commented: Matt J on 23 Jan 2022
Hello,
I'm trying to find the eigenvalues and eigenvectors of an invertible matrix. The eig function returns me complex values.
But the matrix is invertible: I invert it on Pascal.
How to explain and especially how to solve this problem please?
The matrix I am trying to invert is the inv(C)*A matrix, from the attached files.
Thanks,
Michael
Matt J on 22 Jan 2022
That matrix is not symmetric, so there is no reason to think it will have real eigenvalues.

Torsten on 22 Jan 2022
Edited: Torsten on 22 Jan 2022
Use
E = eig(A,C)
E = eig(inv(C)*A)
or
E = eig(C\A)
Michael cohen on 23 Jan 2022
Wouah, thank you very much. It’s very clear and allow us to solve our problem 🙏

Matt J on 22 Jan 2022
Edited: Matt J on 22 Jan 2022
It turns out that B=C\A does have real eigenvalues in this particular case, but floating point errors approximations produce a small imaginary part that can be ignored.
E=eig(C\A);
I=norm(imag(E))/norm(real(E))
I = 3.3264e-18
So just discard the imaginary values,
E=real(E);
##### 2 CommentsShowHide 1 older comment
Matt J on 23 Jan 2022

R2020b

### Community Treasure Hunt

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

Start Hunting!

Translated by