From: paxk zander on
Hi there,

I encountered the following problem while trying to simulate a physical phenomenon (grating diffraction):
at a certain point in the program, i need to calculate the eigenvalues of a relatively large matrix (composed of 4 smaller matrices, upper left: zero matrix, upper right: identity matrix, lower right: diagonal matrix, lower left: "common" matrix) - dont know if this matters.
anyway, at certain values of the physical parameters, matlab computes eigenvalues with a non-zero imaginary part - which is physically impossible. i'm almost sure this is due to numerical errors. which brings me to my question: what possibilities offers matlab to avoid such numerical errors? 'nobalance' as a parameter for eig() doesn't have any effect.

thanks in advance!
From: Matt J on
"paxk zander" <zander_frank1(a)web.de> wrote in message <hng41h$q82$1(a)fred.mathworks.com>...
> Hi there,
>
> I encountered the following problem while trying to simulate a physical phenomenon (grating diffraction):
> at a certain point in the program, i need to calculate the eigenvalues of a relatively large matrix (composed of 4 smaller matrices, upper left: zero matrix, upper right: identity matrix, lower right: diagonal matrix, lower left: "common" matrix) - dont know if this matters.
> anyway, at certain values of the physical parameters, matlab computes eigenvalues with a non-zero imaginary part - which is physically impossible. i'm almost sure this is due to numerical errors.
==========================

If it's due to numerical errors, why not just throw away the presumably super-small non-zero imaginary part using, say, real().

Another question to ask is, if complex eigenvalues are physically impossible, why didn't your physical modeling lead to a Hermitian or symmetric matrix? This obviously isn't the only way to gaurantee real eignevalues, but it's typically what happens.