Ordering the eigenvalues in Matlab

In summary, there is a problem with the ordering of eigenvalues in Matlab, but it can be solved by sorting the result using the code provided. The documentation for this function can be found on the Matlab website.
  • #1
brydustin
205
0
Normally when I work in matlab, the eigenvalues of a matrix are arranged in order from least to greatest when I call the function eig(Matrix).

But for some reason, Matlab has decided to start arranging them in order of magnitude (greatest to least)... so that it would arrange the following arbitrary eigenvalues {-3,4,0,-5,6} as:
{6,-5,4,-3,0} rather than the default (smallest to largest with respect to value NOT magnitude): i.e. {-5, -3, 0, 4,6}

Is there a way to put it back? Also, could it be the data type (for example, can certain matrices like orthogonal or symmetric or complex etc... change the way that eig spits out). I'm dealing with real eigenvalues (obviously there is no "standard ordering" of complex numbers (with imaginary parts).
Finally, ... is there really a "default" listing? I know if I take eig([1 0; 0 -1]) it will give {-1,1} every time, for example.
Thanks to all!
 
Physics news on Phys.org
  • #2
  • Like
Likes FactChecker

FAQ: Ordering the eigenvalues in Matlab

What is the purpose of ordering eigenvalues in Matlab?

The purpose of ordering eigenvalues in Matlab is to organize them in a specific way that makes it easier to analyze and interpret the data. This can help identify patterns and relationships between the eigenvalues and their corresponding eigenvectors.

How can I order eigenvalues in Matlab?

To order eigenvalues in Matlab, you can use the "sort" function. This function allows you to specify the order in which you want the eigenvalues to be sorted, such as ascending or descending. You can also use the "eig" function to calculate the eigenvalues and then use the "sort" function to order them.

What is the difference between ascending and descending order for eigenvalues?

Ascending order for eigenvalues means they will be arranged from smallest to largest, while descending order means they will be arranged from largest to smallest. The choice of order will depend on the specific analysis or interpretation you are trying to achieve.

Can I specify a specific order for eigenvalues in Matlab?

Yes, you can specify a specific order for eigenvalues in Matlab by using the "sort" function and specifying the desired order. You can also use the "eig" function to calculate the eigenvalues and then use the "sort" function to order them according to your desired order.

What are some practical applications of ordering eigenvalues in Matlab?

Ordering eigenvalues in Matlab can be useful in various fields such as data analysis, signal processing, and machine learning. It can help identify dominant patterns or features in the data, reduce the dimensionality of the data, and improve the performance of algorithms that rely on eigenvalues, such as principal component analysis.

Similar threads

Replies
3
Views
24K
Replies
1
Views
3K
Replies
1
Views
6K
Replies
12
Views
2K
Replies
3
Views
2K
Back
Top