Asked by Hayashi
on 4 Jun 2013

I have two predetermined matrices A,B of size 4 x 4. I have a function whose independent variable is some complex number z and produces the eigenvalues of (A-z*B). Upon plotting however, strange blotches show up which I suspect are areas of discontinuity. However, the function is not discontinuous. Therefore, I think MATLAB may be mixing up the eigenvalues somehow. I don't know how the eigenvalues are organized but is there a way to ensure that the eigenvalues are grouped correctly?

*No products are associated with this question.*

Answer by James Tursa
on 4 Jun 2013

Accepted answer

You might try this FEX submission by John D'Errico:

http://www.mathworks.com/matlabcentral/fileexchange/22885-eigenshuffle

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today
## 3 Comments

## the cyclist (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/78013#comment_152919

What do you mean by "grouped correctly"? There is no definitive grouping for eigenvalues.

## Matt J (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/78013#comment_152937

Since A and B are simply 4x4, why don't you tell us what they are and give us the range of z needed to duplicate your plots?

## Hayashi (view profile)

Direct link to this comment:http://www.mathworks.com/matlabcentral/answers/78013#comment_153049

Do you mean there is no definitive grouping for eigenvalues in MATLAB or within a mathematical context? As for the matrices being 4x4, I really should have said that was simply an example. Most of the matrices will be at least 16x16. As for the range, I tend to adjust it so that the plot shows the eigenvalues.