From: Daniel Moham on
"Robert Sparr" <robertdotsparr(a)NOSPAMsri.com> wrote in message <fdhvq6$hok$1(a)fred.mathworks.com>...
> I'm doing eigendecomposition-based spectral analysis, and I
> am looking for a way to recover the eigenvalues of a matrix
> (positive semidefinite Hermitian, in my case) without having
> them sorted for me.
>
> I've seen this topic come up in other threads (such as
> "Sorted Eigenvalues & Eigenvectors?" of April 2004 and
> "non-sorting SVD" of May 2007), but the answers there
> haven't settled my problem.
>
> In my experience, eig() always returns the eigenvalues
> sorted in ascending order, despite statements to the
> contrary in previous threads. (Perhaps this changed with a
> recent version?)
>
> I am aware that the eigenvectors have been sorted so that
> eigenvector index i corresponds to eigenvalue index i, and I
> know how to reconstruct the signal with the sorted output
> given by eig(), but that is not sufficient. I also need to
> know the indexes that the significant eigenvalues had before
> they were sorted. The ideal way to do this would be if
> eig() or some other function had an optional argument I
> could use to suppress the sorting function in eig(). (After
> all, MATLAB has an easy-to-use sort() function, if I want
> sorted output.) Since this seems to be a recurring
> question, I suspect other people want this, too.
>
> Thanks for any suggestions,
> R

This might work;

[p,idx]=esort(diag(D)); D=diag(p); P=P(:,idx);

or

http://www.mathworks.com/matlabcentral/fileexchange/18904-sort-eigenvectors-eigenvalues
 | 
Pages: 1
Prev: about jpeg9.7 filter
Next: parallel execution