Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
unsorted eigenvalues

Subject: unsorted eigenvalues

From: Robert Sparr

Date: 28 Sep, 2007 04:26:46

Message: 1 of 18

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

Subject: unsorted eigenvalues

From: Simon Preston

Date: 28 Sep, 2007 12:49:15

Message: 2 of 18

"Robert Sparr" <robertdotsparr@NOSPAMsri.com> wrote in
message <fdhvq6$hok$1@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

What is the significance of unsorted eigenvalues? I mean,
the eigenvalues are roots of the characteristic polynomial -
in what sense do these roots have order?

Best wishes, S

Subject: unsorted eigenvalues

From: Steven Lord

Date: 28 Sep, 2007 13:41:56

Message: 3 of 18


"Robert Sparr" <robertdotsparr@NOSPAMsri.com> wrote in message
news:fdhvq6$hok$1@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 think you may have misunderstood what was said in those previous threads.
We don't guarantee that the eigenvalues are returned in sorted order. We
also don't guarantee that the eigenvalues are not returned in sorted order.
We just return them from EIG in the order that the LAPACK routine that
calculates them returns them to EIG. If you want to guarantee that they are
sorted, sort them using SORT.

> 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.

I don't understand what you're asking for. If I calculate the eigenvalues
of magic(4):

[V, D] = eig(magic(4));
eigenvalues = diag(D)

eigenvalues =

                        34
          8.94427190999916
         -8.94427190999915
     9.41628944095001e-016

what are the "indexes [sic] that the significant eigenvalues had before they
were sorted"? What ordering are you looking for, and how would MATLAB
determine this ordering from the matrix?

If you're thinking about some sort of ordering of the eigenvalues to
correspond to the eigenvectors, just use the 2 output form of EIG. The kth
column of V above is the eigenvector corresponding to the kth eigenvalue in
D, D(k, k).

If you want the eigenvalues in some pseudorandom order, use RANDPERM to
permute them. Note that one of the permutations will order the eigenvalues
in ascending order and one will order them in descending order. You can use
ISSORTED to test for these cases and use RANDPERM again to permute them.

*snip*

--
Steve Lord
slord@mathworks.com

Subject: unsorted eigenvalues

From: Peter Boettcher

Date: 28 Sep, 2007 13:46:18

Message: 4 of 18

"Robert Sparr" <robertdotsparr@NOSPAMsri.com> writes:

> 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.

What is the true order of the roots of this polynomial?

x^3 - 2*x^2 +3*x -3

-Peter

Subject: unsorted eigenvalues

From: Masakazu Iwamura

Date: 18 Nov, 2007 11:37:44

Message: 5 of 18

Hi Robert and all,

I was in the same problem. But, now I have the answer.

> What is the significance of unsorted eigenvalues? I mean,
> the eigenvalues are roots of the characteristic polynomial -
> in what sense do these roots have order?

Since an eigenvector matrix is just a rotating matrix, there
are a CORRESPONDENCE between the original order and the
order of eigenvalues after eigenvalue decomposition. What we
are talking about is this.

Here is the answer:

C=cov(some_data);
[V,D]=eig(C);
unsorted_eigenvalues=V'*C*V;

I hope your answer is the same one:)

Best,
Masakazu

Subject: unsorted eigenvalues

From: Masakazu Iwamura

Date: 18 Nov, 2007 11:38:42

Message: 6 of 18

Hi Robert and all,

I was in the same problem. But, now I have the answer.

> What is the significance of unsorted eigenvalues? I mean,
> the eigenvalues are roots of the characteristic polynomial -
> in what sense do these roots have order?

Since an eigenvector matrix is just a rotating matrix, there
are a CORRESPONDENCE between the original order and the
order of eigenvalues after eigenvalue decomposition. What we
are talking about is this.

Here is the answer:

C=cov(some_data);
[V,D]=eig(C);
unsorted_eigenvalues=V'*C*V;

I hope your answer is the same one:)

Best,
Masakazu

Subject: unsorted eigenvalues

From: Masakazu Iwamura

Date: 18 Nov, 2007 12:28:58

Message: 7 of 18

Hi,

> Here is the answer:
>
> C=cov(some_data);
> [V,D]=eig(C);
> unsorted_eigenvalues=V'*C*V;

This seems to be my misunderstanding. I couldn't get what I
want:(

Best,
Masakazu

Subject: unsorted eigenvalues

From: John D'Errico

Date: 18 Nov, 2007 12:51:42

Message: 8 of 18

"Masakazu Iwamura" <masa@AHOAHOcs.osakafu-u.ac.jp> wrote in message
<fhpb69$k4u$1@fred.mathworks.com>...
> Hi,
>
> > Here is the answer:
> >
> > C=cov(some_data);
> > [V,D]=eig(C);
> > unsorted_eigenvalues=V'*C*V;
>
> This seems to be my misunderstanding. I couldn't get what I
> want:(

The problem is in your wish for something
that is "unsorted".

A sorted vector means that it has a definite,
known order. Unsorted merely means that
this ordering has not been applied. It does
not mean that you will get any desired
ordering. The ordering may then be arbitrary,
which is not what you seem to be wishing
for.

What people seem to want when they ask
for unsorted eigenvalues is their OWN
(magically chosen) ordering for the
eigenvalues. However, the eigenvalue
code cannot understand this, or know
that ordering. The eigenvalues are merely
a set of polynomial roots in the complex
plane.

John

Subject: unsorted eigenvalues

From: Morad Kassem

Date: 4 Feb, 2009 11:11:01

Message: 9 of 18

Peter Boettcher <boettcher@ll.mit.edu> wrote in message <muytzpeaonp.fsf@G99-Boettcher.llan.ll.mit.edu>...
> "Robert Sparr" <robertdotsparr@NOSPAMsri.com> writes:
>
> > 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.
>
> What is the true order of the roots of this polynomial?
>
> x^3 - 2*x^2 +3*x -3
>
> -Peter

 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.

Morad

Subject: unsorted eigenvalues

From: Morad Kassem

Date: 4 Feb, 2009 11:11:02

Message: 10 of 18

Peter Boettcher <boettcher@ll.mit.edu> wrote in message <muytzpeaonp.fsf@G99-Boettcher.llan.ll.mit.edu>...
> "Robert Sparr" <robertdotsparr@NOSPAMsri.com> writes:
>
> > 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.
>
> What is the true order of the roots of this polynomial?
>
> x^3 - 2*x^2 +3*x -3
>
> -Peter

 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.

Morad

Subject: unsorted eigenvalues

From: Morad Kassem

Date: 4 Feb, 2009 11:18:02

Message: 11 of 18

"Robert Sparr" <robertdotsparr@NOSPAMsri.com> wrote in message <fdhvq6$hok$1@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

 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.
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.

 i hope i was enough clear and that this will solve your problem

best regards
Morad

Subject: unsorted eigenvalues

From: John D'Errico

Date: 4 Feb, 2009 15:03:02

Message: 12 of 18

"Morad Kassem" <morad_kassem@hotmail.com> wrote in message <gmbtha$dip$1@fred.mathworks.com>...

> 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.
> 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.
>
> i hope i was enough clear and that this will solve your problem

Yes, this is probably the best solution, and one
that I have wanted to do for a while. I wrote it
up this morning, and posted eigenshuffle.m on
the file exchange. Look for it later today or
possibly tomorrow.

John

Subject: unsorted eigenvalues

From: Daniel Moham

Date: 27 Jul, 2010 01:49:03

Message: 13 of 18

"Robert Sparr" <robertdotsparr@NOSPAMsri.com> wrote in message <fdhvq6$hok$1@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

Subject: unsorted eigenvalues

From: Stephanie

Date: 25 Jun, 2012 16:43:06

Message: 14 of 18

"Morad Kassem" wrote in message <gmbtha$dip$1@fred.mathworks.com>...
> "Robert Sparr" <robertdotsparr@NOSPAMsri.com> wrote in message <fdhvq6$hok$1@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.
...

> 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.
> 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.
>
> i hope i was enough clear and that this will solve your problem
>
> best regards
> Morad

------------------------------------------------------------------------------------------
Hi Morad,
It's been a long while since this post has been of interest. I am having the same problem of desorting eigens. I couldn't understand your solution, could you make it more clear. What is V(frequency) ?? I assumed V is the eigenvector, but how then?

(This solution, as much as I could understand, is dependent on the very first eig calculation, and it follows that. But what about that first calculation, how will that be grounded ?)

I hope you are still there and have an answer for me.. Thanks a lot !

Subject: unsorted eigenvalues

From: Steven_Lord

Date: 25 Jun, 2012 18:58:18

Message: 15 of 18



"Stephanie " <istiridYex@gmail.com> wrote in message
news:jsa4eq$d8b$1@newscl01ah.mathworks.com...
> "Morad Kassem" wrote in message <gmbtha$dip$1@fred.mathworks.com>...
>> "Robert Sparr" <robertdotsparr@NOSPAMsri.com> wrote in message
>> <fdhvq6$hok$1@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.
> ...
>
>> 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.
>> 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.
>>
>> i hope i was enough clear and that this will solve your problem best
>> regards Morad
>
> ------------------------------------------------------------------------------------------
> Hi Morad,
> It's been a long while since this post has been of interest. I am having
> the same problem of desorting eigens. I couldn't understand your solution,
> could you make it more clear. What is V(frequency) ?? I assumed V is the
> eigenvector, but how then?
> (This solution, as much as I could understand, is dependent on the very
> first eig calculation, and it follows that. But what about that first
> calculation, how will that be grounded ?)

Define "first" in the context of eigenvalues. What would _you_ consider to
be the "first eigenvalue" in this context?

[V, D] = eig(magic(5))

If you mean smallest or largest magnitude, then things get somewhat fuzzy
when multiple eigenvalues have almost the same magnitude but MIN or MAX may
be useful to you. If you mean something else, like "the eigenvalue the
algorithm EIG uses computed 'first' according to the clock" then that may
not make sense or be an answerable question in a multithreaded/parallel
world.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: unsorted eigenvalues

From: Stephanie

Date: 26 Jun, 2012 07:52:07

Message: 16 of 18

"Steven_Lord" <slord@mathworks.com> wrote in message <jsacc9$kbt$1@newscl01ah.mathworks.com>...
>
>
> "Stephanie " <istiridYex@gmail.com> wrote in message
> news:jsa4eq$d8b$1@newscl01ah.mathworks.com...
> > "Morad Kassem" wrote in message <gmbtha$dip$1@fred.mathworks.com>...
> >> "Robert Sparr" <robertdotsparr@NOSPAMsri.com> wrote in message
> >> <fdhvq6$hok$1@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.
> > ...
> >
> >> 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.
> >> 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.
> >>
> >> i hope i was enough clear and that this will solve your problem best
> >> regards Morad
> >
> > ------------------------------------------------------------------------------------------
> > Hi Morad,
> > It's been a long while since this post has been of interest. I am having
> > the same problem of desorting eigens. I couldn't understand your solution,
> > could you make it more clear. What is V(frequency) ?? I assumed V is the
> > eigenvector, but how then?
> > (This solution, as much as I could understand, is dependent on the very
> > first eig calculation, and it follows that. But what about that first
> > calculation, how will that be grounded ?)
>
> Define "first" in the context of eigenvalues. What would _you_ consider to
> be the "first eigenvalue" in this context?
>
> [V, D] = eig(magic(5))
>
> If you mean smallest or largest magnitude, then things get somewhat fuzzy
> when multiple eigenvalues have almost the same magnitude but MIN or MAX may
> be useful to you. If you mean something else, like "the eigenvalue the
> algorithm EIG uses computed 'first' according to the clock" then that may
> not make sense or be an answerable question in a multithreaded/parallel
> world.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com


Hi Steve,
A matrix is not a standalone structure. It (3x3 in my case) represents a rotation+scaling wrt an input system. I have to know which axis is rotated to which eigenvector, and by which eigenvalue it is scaled with, so that I can correctly slice the ellipsoid that matrix represents. This is the issue. I hope I am more clear now. Any ideas now? Thanks a lot..

Subject: unsorted eigenvalues

From: Remus

Date: 7 Dec, 2012 03:40:14

Message: 17 of 18

"Stephanie" wrote in message <jsbpn7$mk6$1@newscl01ah.mathworks.com>...
> "Steven_Lord" <slord@mathworks.com> wrote in message <jsacc9$kbt$1@newscl01ah.mathworks.com>...
> >
> >
> > "Stephanie " <istiridYex@gmail.com> wrote in message
> > news:jsa4eq$d8b$1@newscl01ah.mathworks.com...
> > > "Morad Kassem" wrote in message <gmbtha$dip$1@fred.mathworks.com>...
> > >> "Robert Sparr" <robertdotsparr@NOSPAMsri.com> wrote in message
> > >> <fdhvq6$hok$1@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.
> > > ...
> > >
> > >> 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.
> > >> 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.
> > >>
> > >> i hope i was enough clear and that this will solve your problem best
> > >> regards Morad
> > >
> > > ------------------------------------------------------------------------------------------
> > > Hi Morad,
> > > It's been a long while since this post has been of interest. I am having
> > > the same problem of desorting eigens. I couldn't understand your solution,
> > > could you make it more clear. What is V(frequency) ?? I assumed V is the
> > > eigenvector, but how then?
> > > (This solution, as much as I could understand, is dependent on the very
> > > first eig calculation, and it follows that. But what about that first
> > > calculation, how will that be grounded ?)
> >
> > Define "first" in the context of eigenvalues. What would _you_ consider to
> > be the "first eigenvalue" in this context?
> >
> > [V, D] = eig(magic(5))
> >
> > If you mean smallest or largest magnitude, then things get somewhat fuzzy
> > when multiple eigenvalues have almost the same magnitude but MIN or MAX may
> > be useful to you. If you mean something else, like "the eigenvalue the
> > algorithm EIG uses computed 'first' according to the clock" then that may
> > not make sense or be an answerable question in a multithreaded/parallel
> > world.
> >
> > --
> > Steve Lord
> > slord@mathworks.com
> > To contact Technical Support use the Contact Us link on
> > http://www.mathworks.com
>
>
> Hi Steve,
> A matrix is not a standalone structure. It (3x3 in my case) represents a rotation+scaling wrt an input system. I have to know which axis is rotated to which eigenvector, and by which eigenvalue it is scaled with, so that I can correctly slice the ellipsoid that matrix represents. This is the issue. I hope I am more clear now. Any ideas now? Thanks a lot..

Subject: unsorted eigenvalues

From: Emilie

Date: 5 Aug, 2014 18:15:11

Message: 18 of 18

"Remus " <remusac@yahoo.com> wrote in message <k9roeu$fdr$1@newscl01ah.mathworks.com>...
> "Stephanie" wrote in message <jsbpn7$mk6$1@newscl01ah.mathworks.com>...
> > "Steven_Lord" <slord@mathworks.com> wrote in message <jsacc9$kbt$1@newscl01ah.mathworks.com>...
> > >
> > >
> > > "Stephanie " <istiridYex@gmail.com> wrote in message
> > > news:jsa4eq$d8b$1@newscl01ah.mathworks.com...
> > > > "Morad Kassem" wrote in message <gmbtha$dip$1@fred.mathworks.com>...
> > > >> "Robert Sparr" <robertdotsparr@NOSPAMsri.com> wrote in message
> > > >> <fdhvq6$hok$1@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.
> > > > ...
> > > >
> > > >> 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.
> > > >> 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.
> > > >>
> > > >> i hope i was enough clear and that this will solve your problem best
> > > >> regards Morad
> > > >
> > > > ------------------------------------------------------------------------------------------
> > > > Hi Morad,
> > > > It's been a long while since this post has been of interest. I am having
> > > > the same problem of desorting eigens. I couldn't understand your solution,
> > > > could you make it more clear. What is V(frequency) ?? I assumed V is the
> > > > eigenvector, but how then?
> > > > (This solution, as much as I could understand, is dependent on the very
> > > > first eig calculation, and it follows that. But what about that first
> > > > calculation, how will that be grounded ?)
> > >
> > > Define "first" in the context of eigenvalues. What would _you_ consider to
> > > be the "first eigenvalue" in this context?
> > >
> > > [V, D] = eig(magic(5))
> > >
> > > If you mean smallest or largest magnitude, then things get somewhat fuzzy
> > > when multiple eigenvalues have almost the same magnitude but MIN or MAX may
> > > be useful to you. If you mean something else, like "the eigenvalue the
> > > algorithm EIG uses computed 'first' according to the clock" then that may
> > > not make sense or be an answerable question in a multithreaded/parallel
> > > world.
> > >
> > > --
> > > Steve Lord
> > > slord@mathworks.com
> > > To contact Technical Support use the Contact Us link on
> > > http://www.mathworks.com
> >
> >
> > Hi Steve,
> > A matrix is not a standalone structure. It (3x3 in my case) represents a rotation+scaling wrt an input system. I have to know which axis is rotated to which eigenvector, and by which eigenvalue it is scaled with, so that I can correctly slice the ellipsoid that matrix represents. This is the issue. I hope I am more clear now. Any ideas now? Thanks a lot..

Hi Stephanie!

I know it's been two years, but I am trying to do the exact same thing as you. Were you ever able to solve this problem? I attempted using the esort function, but I can't tell whether it's giving me accurate info. Thanks in advance!

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us