<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868</link>
    <title>MATLAB Central Newsreader - unsorted eigenvalues</title>
    <description>Feed for thread: unsorted eigenvalues</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Fri, 28 Sep 2007 04:26:46 -0400</pubDate>
      <title>unsorted eigenvalues</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868#394328</link>
      <author>Robert Sparr</author>
      <description>I'm doing eigendecomposition-based spectral analysis, and I&lt;br&gt;
am looking for a way to recover the eigenvalues of a matrix&lt;br&gt;
(positive semidefinite Hermitian, in my case) without having&lt;br&gt;
them sorted for me.&lt;br&gt;
&lt;br&gt;
I've seen this topic come up in other threads (such as&lt;br&gt;
&quot;Sorted Eigenvalues &amp; Eigenvectors?&quot; of April 2004 and&lt;br&gt;
&quot;non-sorting SVD&quot; of May 2007), but the answers there&lt;br&gt;
haven't settled my problem.&lt;br&gt;
&lt;br&gt;
In my experience, eig() always returns the eigenvalues&lt;br&gt;
sorted in ascending order, despite statements to the&lt;br&gt;
contrary in previous threads.  (Perhaps this changed with a&lt;br&gt;
recent version?)&lt;br&gt;
&lt;br&gt;
I am aware that the eigenvectors have been sorted so that&lt;br&gt;
eigenvector index i corresponds to eigenvalue index i, and I&lt;br&gt;
know how to reconstruct the signal with the sorted output&lt;br&gt;
given by eig(), but that is not sufficient.  I also need to&lt;br&gt;
know the indexes that the significant eigenvalues had before&lt;br&gt;
they were sorted.  The ideal way to do this would be if&lt;br&gt;
eig() or some other function had an optional argument I&lt;br&gt;
could use to suppress the sorting function in eig().  (After&lt;br&gt;
all, MATLAB has an easy-to-use sort() function, if I want&lt;br&gt;
sorted output.)  Since this seems to be a recurring&lt;br&gt;
question, I suspect other people want this, too.&lt;br&gt;
&lt;br&gt;
Thanks for any suggestions,&lt;br&gt;
R</description>
    </item>
    <item>
      <pubDate>Fri, 28 Sep 2007 12:49:15 -0400</pubDate>
      <title>Re: unsorted eigenvalues</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868#394362</link>
      <author>Simon Preston</author>
      <description>&quot;Robert Sparr&quot; &amp;lt;robertdotsparr@NOSPAMsri.com&amp;gt; wrote in&lt;br&gt;
message &amp;lt;fdhvq6$hok$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I'm doing eigendecomposition-based spectral analysis, and I&lt;br&gt;
&amp;gt; am looking for a way to recover the eigenvalues of a matrix&lt;br&gt;
&amp;gt; (positive semidefinite Hermitian, in my case) without having&lt;br&gt;
&amp;gt; them sorted for me.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I've seen this topic come up in other threads (such as&lt;br&gt;
&amp;gt; &quot;Sorted Eigenvalues &amp; Eigenvectors?&quot; of April 2004 and&lt;br&gt;
&amp;gt; &quot;non-sorting SVD&quot; of May 2007), but the answers there&lt;br&gt;
&amp;gt; haven't settled my problem.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In my experience, eig() always returns the eigenvalues&lt;br&gt;
&amp;gt; sorted in ascending order, despite statements to the&lt;br&gt;
&amp;gt; contrary in previous threads.  (Perhaps this changed with a&lt;br&gt;
&amp;gt; recent version?)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am aware that the eigenvectors have been sorted so that&lt;br&gt;
&amp;gt; eigenvector index i corresponds to eigenvalue index i, and I&lt;br&gt;
&amp;gt; know how to reconstruct the signal with the sorted output&lt;br&gt;
&amp;gt; given by eig(), but that is not sufficient.  I also need to&lt;br&gt;
&amp;gt; know the indexes that the significant eigenvalues had before&lt;br&gt;
&amp;gt; they were sorted.  The ideal way to do this would be if&lt;br&gt;
&amp;gt; eig() or some other function had an optional argument I&lt;br&gt;
&amp;gt; could use to suppress the sorting function in eig().  (After&lt;br&gt;
&amp;gt; all, MATLAB has an easy-to-use sort() function, if I want&lt;br&gt;
&amp;gt; sorted output.)  Since this seems to be a recurring&lt;br&gt;
&amp;gt; question, I suspect other people want this, too.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks for any suggestions,&lt;br&gt;
&amp;gt; R&lt;br&gt;
&lt;br&gt;
What is the significance of unsorted eigenvalues?  I mean,&lt;br&gt;
the eigenvalues are roots of the characteristic polynomial -&lt;br&gt;
in what sense do these roots have order?&lt;br&gt;
&lt;br&gt;
Best wishes, S</description>
    </item>
    <item>
      <pubDate>Fri, 28 Sep 2007 13:41:56 -0400</pubDate>
      <title>Re: unsorted eigenvalues</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868#394371</link>
      <author>Steven Lord</author>
      <description>&lt;br&gt;
&quot;Robert Sparr&quot; &amp;lt;robertdotsparr@NOSPAMsri.com&amp;gt; wrote in message &lt;br&gt;
news:fdhvq6$hok$1@fred.mathworks.com...&lt;br&gt;
&amp;gt; I'm doing eigendecomposition-based spectral analysis, and I&lt;br&gt;
&amp;gt; am looking for a way to recover the eigenvalues of a matrix&lt;br&gt;
&amp;gt; (positive semidefinite Hermitian, in my case) without having&lt;br&gt;
&amp;gt; them sorted for me.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I've seen this topic come up in other threads (such as&lt;br&gt;
&amp;gt; &quot;Sorted Eigenvalues &amp; Eigenvectors?&quot; of April 2004 and&lt;br&gt;
&amp;gt; &quot;non-sorting SVD&quot; of May 2007), but the answers there&lt;br&gt;
&amp;gt; haven't settled my problem.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; In my experience, eig() always returns the eigenvalues&lt;br&gt;
&amp;gt; sorted in ascending order, despite statements to the&lt;br&gt;
&amp;gt; contrary in previous threads.  (Perhaps this changed with a&lt;br&gt;
&amp;gt; recent version?)&lt;br&gt;
&lt;br&gt;
I think you may have misunderstood what was said in those previous threads. &lt;br&gt;
We don't guarantee that the eigenvalues are returned in sorted order.  We &lt;br&gt;
also don't guarantee that the eigenvalues are not returned in sorted order. &lt;br&gt;
We just return them from EIG in the order that the LAPACK routine that &lt;br&gt;
calculates them returns them to EIG.  If you want to guarantee that they are &lt;br&gt;
sorted, sort them using SORT.&lt;br&gt;
&lt;br&gt;
&amp;gt; I am aware that the eigenvectors have been sorted so that&lt;br&gt;
&amp;gt; eigenvector index i corresponds to eigenvalue index i, and I&lt;br&gt;
&amp;gt; know how to reconstruct the signal with the sorted output&lt;br&gt;
&amp;gt; given by eig(), but that is not sufficient.  I also need to&lt;br&gt;
&amp;gt; know the indexes that the significant eigenvalues had before&lt;br&gt;
&amp;gt; they were sorted.&lt;br&gt;
&lt;br&gt;
I don't understand what you're asking for.  If I calculate the eigenvalues &lt;br&gt;
of magic(4):&lt;br&gt;
&lt;br&gt;
[V, D] = eig(magic(4));&lt;br&gt;
eigenvalues = diag(D)&lt;br&gt;
&lt;br&gt;
eigenvalues =&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;34&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;8.94427190999916&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;-8.94427190999915&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;9.41628944095001e-016&lt;br&gt;
&lt;br&gt;
what are the &quot;indexes [sic] that the significant eigenvalues had before they &lt;br&gt;
were sorted&quot;?  What ordering are you looking for, and how would MATLAB &lt;br&gt;
determine this ordering from the matrix?&lt;br&gt;
&lt;br&gt;
If you're thinking about some sort of ordering of the eigenvalues to &lt;br&gt;
correspond to the eigenvectors, just use the 2 output form of EIG.  The kth &lt;br&gt;
column of V above is the eigenvector corresponding to the kth eigenvalue in &lt;br&gt;
D, D(k, k).&lt;br&gt;
&lt;br&gt;
If you want the eigenvalues in some pseudorandom order, use RANDPERM to &lt;br&gt;
permute them.  Note that one of the permutations will order the eigenvalues &lt;br&gt;
in ascending order and one will order them in descending order.  You can use &lt;br&gt;
ISSORTED to test for these cases and use RANDPERM again to permute them.&lt;br&gt;
&lt;br&gt;
*snip*&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Steve Lord&lt;br&gt;
slord@mathworks.com </description>
    </item>
    <item>
      <pubDate>Fri, 28 Sep 2007 13:46:18 -0400</pubDate>
      <title>Re: unsorted eigenvalues</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868#394373</link>
      <author>Peter Boettcher</author>
      <description>&quot;Robert Sparr&quot; &amp;lt;robertdotsparr@NOSPAMsri.com&amp;gt; writes:&lt;br&gt;
&lt;br&gt;
&amp;gt; I am aware that the eigenvectors have been sorted so that&lt;br&gt;
&amp;gt; eigenvector index i corresponds to eigenvalue index i, and I&lt;br&gt;
&amp;gt; know how to reconstruct the signal with the sorted output&lt;br&gt;
&amp;gt; given by eig(), but that is not sufficient.  I also need to&lt;br&gt;
&amp;gt; know the indexes that the significant eigenvalues had before&lt;br&gt;
&amp;gt; they were sorted.&lt;br&gt;
&lt;br&gt;
What is the true order of the roots of this polynomial?&lt;br&gt;
&lt;br&gt;
x^3 - 2*x^2 +3*x -3&lt;br&gt;
&lt;br&gt;
-Peter</description>
    </item>
    <item>
      <pubDate>Sun, 18 Nov 2007 11:37:44 -0500</pubDate>
      <title>Re: unsorted eigenvalues</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868#401940</link>
      <author>Masakazu Iwamura</author>
      <description>Hi Robert and all,&lt;br&gt;
&lt;br&gt;
I was in the same problem. But, now I have the answer.&lt;br&gt;
&lt;br&gt;
&amp;gt; What is the significance of unsorted eigenvalues?  I mean,&lt;br&gt;
&amp;gt; the eigenvalues are roots of the characteristic polynomial -&lt;br&gt;
&amp;gt; in what sense do these roots have order?&lt;br&gt;
&lt;br&gt;
Since an eigenvector matrix is just a rotating matrix, there&lt;br&gt;
are a CORRESPONDENCE between the original order and the&lt;br&gt;
order of eigenvalues after eigenvalue decomposition. What we&lt;br&gt;
are talking about is this.&lt;br&gt;
&lt;br&gt;
Here is the answer:&lt;br&gt;
&lt;br&gt;
C=cov(some_data);&lt;br&gt;
[V,D]=eig(C);&lt;br&gt;
unsorted_eigenvalues=V'*C*V;&lt;br&gt;
&lt;br&gt;
I hope your answer is the same one:)&lt;br&gt;
&lt;br&gt;
Best,&lt;br&gt;
Masakazu</description>
    </item>
    <item>
      <pubDate>Sun, 18 Nov 2007 11:38:42 -0500</pubDate>
      <title>Re: unsorted eigenvalues</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868#401941</link>
      <author>Masakazu Iwamura</author>
      <description>Hi Robert and all,&lt;br&gt;
&lt;br&gt;
I was in the same problem. But, now I have the answer.&lt;br&gt;
&lt;br&gt;
&amp;gt; What is the significance of unsorted eigenvalues?  I mean,&lt;br&gt;
&amp;gt; the eigenvalues are roots of the characteristic polynomial -&lt;br&gt;
&amp;gt; in what sense do these roots have order?&lt;br&gt;
&lt;br&gt;
Since an eigenvector matrix is just a rotating matrix, there&lt;br&gt;
are a CORRESPONDENCE between the original order and the&lt;br&gt;
order of eigenvalues after eigenvalue decomposition. What we&lt;br&gt;
are talking about is this.&lt;br&gt;
&lt;br&gt;
Here is the answer:&lt;br&gt;
&lt;br&gt;
C=cov(some_data);&lt;br&gt;
[V,D]=eig(C);&lt;br&gt;
unsorted_eigenvalues=V'*C*V;&lt;br&gt;
&lt;br&gt;
I hope your answer is the same one:)&lt;br&gt;
&lt;br&gt;
Best,&lt;br&gt;
Masakazu</description>
    </item>
    <item>
      <pubDate>Sun, 18 Nov 2007 12:28:58 -0500</pubDate>
      <title>Re: unsorted eigenvalues</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868#401945</link>
      <author>Masakazu Iwamura</author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
&amp;gt; Here is the answer:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; C=cov(some_data);&lt;br&gt;
&amp;gt; [V,D]=eig(C);&lt;br&gt;
&amp;gt; unsorted_eigenvalues=V'*C*V;&lt;br&gt;
&lt;br&gt;
This seems to be my misunderstanding. I couldn't get what I&lt;br&gt;
want:(&lt;br&gt;
&lt;br&gt;
Best,&lt;br&gt;
Masakazu</description>
    </item>
    <item>
      <pubDate>Sun, 18 Nov 2007 12:51:42 -0500</pubDate>
      <title>Re: unsorted eigenvalues</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868#401947</link>
      <author>John D'Errico</author>
      <description>&quot;Masakazu Iwamura&quot; &amp;lt;masa@AHOAHOcs.osakafu-u.ac.jp&amp;gt; wrote in message &lt;br&gt;
&amp;lt;fhpb69$k4u$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; Hi,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Here is the answer:&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; C=cov(some_data);&lt;br&gt;
&amp;gt; &amp;gt; [V,D]=eig(C);&lt;br&gt;
&amp;gt; &amp;gt; unsorted_eigenvalues=V'*C*V;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; This seems to be my misunderstanding. I couldn't get what I&lt;br&gt;
&amp;gt; want:(&lt;br&gt;
&lt;br&gt;
The problem is in your wish for something&lt;br&gt;
that is &quot;unsorted&quot;.&lt;br&gt;
&lt;br&gt;
A sorted vector means that it has a definite,&lt;br&gt;
known order. Unsorted merely means that&lt;br&gt;
this ordering has not been applied. It does&lt;br&gt;
not mean that you will get any desired&lt;br&gt;
ordering. The ordering may then be arbitrary,&lt;br&gt;
which is not what you seem to be wishing&lt;br&gt;
for.&lt;br&gt;
&lt;br&gt;
What people seem to want when they ask&lt;br&gt;
for unsorted eigenvalues is their OWN&lt;br&gt;
(magically chosen) ordering for the &lt;br&gt;
eigenvalues. However, the eigenvalue&lt;br&gt;
code cannot understand this, or know&lt;br&gt;
that ordering. The eigenvalues are merely&lt;br&gt;
a set of polynomial roots in the complex&lt;br&gt;
plane.&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Wed, 04 Feb 2009 11:11:01 -0500</pubDate>
      <title>Re: unsorted eigenvalues</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868#625972</link>
      <author>Morad Kassem</author>
      <description>Peter Boettcher &amp;lt;boettcher@ll.mit.edu&amp;gt; wrote in message &amp;lt;muytzpeaonp.fsf@G99-Boettcher.llan.ll.mit.edu&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Robert Sparr&quot; &amp;lt;robertdotsparr@NOSPAMsri.com&amp;gt; writes:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I am aware that the eigenvectors have been sorted so that&lt;br&gt;
&amp;gt; &amp;gt; eigenvector index i corresponds to eigenvalue index i, and I&lt;br&gt;
&amp;gt; &amp;gt; know how to reconstruct the signal with the sorted output&lt;br&gt;
&amp;gt; &amp;gt; given by eig(), but that is not sufficient.  I also need to&lt;br&gt;
&amp;gt; &amp;gt; know the indexes that the significant eigenvalues had before&lt;br&gt;
&amp;gt; &amp;gt; they were sorted.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What is the true order of the roots of this polynomial?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; x^3 - 2*x^2 +3*x -3&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -Peter&lt;br&gt;
&lt;br&gt;
&amp;nbsp;I have the same problem and speaking about the order of the eigenvalues it is important because the eigenvectors correspond, in my case, to a rotation matrix used to obtain principal coordinates which changes with frequency. so if eig() organizes the eigenvectors i will never know which vector is which from one frequency to the other as the maximum eigenvalue is not always on the same direction.&lt;br&gt;
&lt;br&gt;
Morad </description>
    </item>
    <item>
      <pubDate>Wed, 04 Feb 2009 11:11:02 -0500</pubDate>
      <title>Re: unsorted eigenvalues</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868#625973</link>
      <author>Morad Kassem</author>
      <description>Peter Boettcher &amp;lt;boettcher@ll.mit.edu&amp;gt; wrote in message &amp;lt;muytzpeaonp.fsf@G99-Boettcher.llan.ll.mit.edu&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Robert Sparr&quot; &amp;lt;robertdotsparr@NOSPAMsri.com&amp;gt; writes:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; I am aware that the eigenvectors have been sorted so that&lt;br&gt;
&amp;gt; &amp;gt; eigenvector index i corresponds to eigenvalue index i, and I&lt;br&gt;
&amp;gt; &amp;gt; know how to reconstruct the signal with the sorted output&lt;br&gt;
&amp;gt; &amp;gt; given by eig(), but that is not sufficient.  I also need to&lt;br&gt;
&amp;gt; &amp;gt; know the indexes that the significant eigenvalues had before&lt;br&gt;
&amp;gt; &amp;gt; they were sorted.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; What is the true order of the roots of this polynomial?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; x^3 - 2*x^2 +3*x -3&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -Peter&lt;br&gt;
&lt;br&gt;
&amp;nbsp;I have the same problem and speaking about the order of the eigenvalues it is important because the eigenvectors correspond, in my case, to a rotation matrix used to obtain principal coordinates which changes with frequency. so if eig() organizes the eigenvectors i will never know which vector is which from one frequency to the other as the maximum eigenvalue is not always on the same direction.&lt;br&gt;
&lt;br&gt;
Morad </description>
    </item>
    <item>
      <pubDate>Wed, 04 Feb 2009 11:18:02 -0500</pubDate>
      <title>Re: unsorted eigenvalues</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868#625975</link>
      <author>Morad Kassem</author>
      <description>&quot;Robert Sparr&quot; &amp;lt;robertdotsparr@NOSPAMsri.com&amp;gt; wrote in message &amp;lt;fdhvq6$hok$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I'm doing eigendecomposition-based spectral analysis, and I&lt;br&gt;
&amp;gt; am looking for a way to recover the eigenvalues of a matrix&lt;br&gt;
&amp;gt; (positive semidefinite Hermitian, in my case) without having&lt;br&gt;
&amp;gt; them sorted for me.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I've seen this topic come up in other threads (such as&lt;br&gt;
&amp;gt; &quot;Sorted Eigenvalues &amp; Eigenvectors?&quot; of April 2004 and&lt;br&gt;
&amp;gt; &quot;non-sorting SVD&quot; of May 2007), but the answers there&lt;br&gt;
&amp;gt; haven't settled my problem.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In my experience, eig() always returns the eigenvalues&lt;br&gt;
&amp;gt; sorted in ascending order, despite statements to the&lt;br&gt;
&amp;gt; contrary in previous threads.  (Perhaps this changed with a&lt;br&gt;
&amp;gt; recent version?)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am aware that the eigenvectors have been sorted so that&lt;br&gt;
&amp;gt; eigenvector index i corresponds to eigenvalue index i, and I&lt;br&gt;
&amp;gt; know how to reconstruct the signal with the sorted output&lt;br&gt;
&amp;gt; given by eig(), but that is not sufficient.  I also need to&lt;br&gt;
&amp;gt; know the indexes that the significant eigenvalues had before&lt;br&gt;
&amp;gt; they were sorted.  The ideal way to do this would be if&lt;br&gt;
&amp;gt; eig() or some other function had an optional argument I&lt;br&gt;
&amp;gt; could use to suppress the sorting function in eig().  (After&lt;br&gt;
&amp;gt; all, MATLAB has an easy-to-use sort() function, if I want&lt;br&gt;
&amp;gt; sorted output.)  Since this seems to be a recurring&lt;br&gt;
&amp;gt; question, I suspect other people want this, too.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks for any suggestions,&lt;br&gt;
&amp;gt; R&lt;br&gt;
&lt;br&gt;
&amp;nbsp;robert i have found one way to sort the eigenvectors and eigenvalues in the correct order in my case i hope it will help you.&lt;br&gt;
as i have the eigenvectiors changing with frequency, after applying eig()  i perform the dot product between V(frequency) and  V(frequency+1) and then i search the indices of the element that are closer to 1 then i reorder my vectors according to the new order.&lt;br&gt;
&lt;br&gt;
&amp;nbsp;i hope i was enough clear and that this will solve your problem &lt;br&gt;
&lt;br&gt;
best regards &lt;br&gt;
Morad</description>
    </item>
    <item>
      <pubDate>Wed, 04 Feb 2009 15:03:02 -0500</pubDate>
      <title>Re: unsorted eigenvalues</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868#626037</link>
      <author>John D'Errico</author>
      <description>&quot;Morad Kassem&quot; &amp;lt;morad_kassem@hotmail.com&amp;gt; wrote in message &amp;lt;gmbtha$dip$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&lt;br&gt;
&amp;gt;  robert i have found one way to sort the eigenvectors and eigenvalues in the correct order in my case i hope it will help you.&lt;br&gt;
&amp;gt; as i have the eigenvectiors changing with frequency, after applying eig()  i perform the dot product between V(frequency) and  V(frequency+1) and then i search the indices of the element that are closer to 1 then i reorder my vectors according to the new order.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  i hope i was enough clear and that this will solve your problem &lt;br&gt;
&lt;br&gt;
Yes, this is probably the best solution, and one&lt;br&gt;
that I have wanted to do for a while. I wrote it&lt;br&gt;
up this morning, and posted eigenshuffle.m on&lt;br&gt;
the file exchange. Look for it later today or&lt;br&gt;
possibly tomorrow.&lt;br&gt;
&lt;br&gt;
John</description>
    </item>
    <item>
      <pubDate>Tue, 27 Jul 2010 01:49:03 -0400</pubDate>
      <title>Re: unsorted eigenvalues</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156868#765890</link>
      <author>Daniel Moham</author>
      <description>&quot;Robert Sparr&quot; &amp;lt;robertdotsparr@NOSPAMsri.com&amp;gt; wrote in message &amp;lt;fdhvq6$hok$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I'm doing eigendecomposition-based spectral analysis, and I&lt;br&gt;
&amp;gt; am looking for a way to recover the eigenvalues of a matrix&lt;br&gt;
&amp;gt; (positive semidefinite Hermitian, in my case) without having&lt;br&gt;
&amp;gt; them sorted for me.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I've seen this topic come up in other threads (such as&lt;br&gt;
&amp;gt; &quot;Sorted Eigenvalues &amp; Eigenvectors?&quot; of April 2004 and&lt;br&gt;
&amp;gt; &quot;non-sorting SVD&quot; of May 2007), but the answers there&lt;br&gt;
&amp;gt; haven't settled my problem.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; In my experience, eig() always returns the eigenvalues&lt;br&gt;
&amp;gt; sorted in ascending order, despite statements to the&lt;br&gt;
&amp;gt; contrary in previous threads.  (Perhaps this changed with a&lt;br&gt;
&amp;gt; recent version?)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I am aware that the eigenvectors have been sorted so that&lt;br&gt;
&amp;gt; eigenvector index i corresponds to eigenvalue index i, and I&lt;br&gt;
&amp;gt; know how to reconstruct the signal with the sorted output&lt;br&gt;
&amp;gt; given by eig(), but that is not sufficient.  I also need to&lt;br&gt;
&amp;gt; know the indexes that the significant eigenvalues had before&lt;br&gt;
&amp;gt; they were sorted.  The ideal way to do this would be if&lt;br&gt;
&amp;gt; eig() or some other function had an optional argument I&lt;br&gt;
&amp;gt; could use to suppress the sorting function in eig().  (After&lt;br&gt;
&amp;gt; all, MATLAB has an easy-to-use sort() function, if I want&lt;br&gt;
&amp;gt; sorted output.)  Since this seems to be a recurring&lt;br&gt;
&amp;gt; question, I suspect other people want this, too.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thanks for any suggestions,&lt;br&gt;
&amp;gt; R&lt;br&gt;
&lt;br&gt;
This might work;&lt;br&gt;
&lt;br&gt;
&amp;nbsp;[p,idx]=esort(diag(D)); D=diag(p); P=P(:,idx);&lt;br&gt;
&lt;br&gt;
or&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://www.mathworks.com/matlabcentral/fileexchange/18904-sort-eigenvectors-eigenvalues&quot;&gt;http://www.mathworks.com/matlabcentral/fileexchange/18904-sort-eigenvectors-eigenvalues&lt;/a&gt;</description>
    </item>
  </channel>
</rss>

