Thread Subject: Eigen value and Eigen vector?

Subject: Eigen value and Eigen vector?

From: Stephen

Date: 16 Aug, 2007 20:20:14

Message: 1 of 7

Hi,

Matlab function [V,D]=eig() would generate eigenvalues in
ascending order and the associated eigenvectors.

Is there an easy way to generate eigenvalues and
associated eigenvectors in descending order?

Thanks,
Stephen

Subject: Eigen value and Eigen vector?

From: "J.N.

Date: 17 Aug, 2007 00:21:08

Message: 2 of 7

On Aug 16, 4:20 pm, "stephen " <huan...@nationwide.com> wrote:
> Hi,
>
> Matlab function [V,D]=eig() would generate eigenvalues in
> ascending order and the associated eigenvectors.
>
> Is there an easy way to generate eigenvalues and
> associated eigenvectors in descending order?
>
> Thanks,
> Stephen

There's probably an easier way, but, if not, try:
 [V,D]=eig()
 V = V(:,length(V(:,1)):-1:1) ;
 D = D(length(D(1,:)):-1:1,length(D(:,1)):-1:1) ;

Joao

Subject: Eigen value and Eigen vector?

From: Titus

Date: 17 Aug, 2007 07:13:25

Message: 3 of 7


"J.N." <joao.natali@gmail.com> schrieb im Newsbeitrag
news:1187310068.805535.110740@19g2000hsx.googlegroups.com...
> On Aug 16, 4:20 pm, "stephen " <huan...@nationwide.com> wrote:
>> Hi,
>>
>> Matlab function [V,D]=eig() would generate eigenvalues in
>> ascending order and the associated eigenvectors.
>>
>> Is there an easy way to generate eigenvalues and
>> associated eigenvectors in descending order?
>>
>> Thanks,
>> Stephen
>
> There's probably an easier way, but, if not, try:
> [V,D]=eig()
> V = V(:,length(V(:,1)):-1:1) ;
> D = D(length(D(1,:)):-1:1,length(D(:,1)):-1:1) ;
>
> Joao
>

Hi,
slightly easier: use "end" instead of length:
V = V(:, end:-1:1);
D = D(end:-1:1,end:-1:1)

Titus


Subject: Eigen value and Eigen vector?

From: us

Date: 17 Aug, 2007 07:55:56

Message: 4 of 7

Titus:
<SNIP the big easy...

> > D = D(length(D(1,:)):-1:1,length(D(:,1)):-1:1) ;

> slightly easier: use "end" instead of length:
> D = D(end:-1:1,end:-1:1)

... or, yet another solution

     D=rot90(D,2)

us

Subject: Eigen value and Eigen vector?

From: Stephen

Date: 17 Aug, 2007 14:08:46

Message: 5 of 7

Thanks for all the responses, guys.

I am a little confused now as I look at the results. I
have an Excel VBA program which could calculate the
Eigenvalues in descending order and the associated
Eigenvetors. If I use the suggested method to calculate
the same things in Matlab, some values of Eigenvector are
exactly the same while some values of Eigenvector are the
same in absolute terms but have opposite signs (plus vs
minus). I use formula V*D*V’ to check if they are getting
the same correlation matrix, and they are.

Does anyone have any idea what’s going on here?

Thanks,
Stephen




"us " <us@neurol.unizh.ch> wrote in message
<fa3kac$rlr$1@fred.mathworks.com>...
> Titus:
> <SNIP the big easy...
>
> > > D = D(length(D(1,:)):-1:1,length(D(:,1)):-1:1) ;
>
> > slightly easier: use "end" instead of length:
> > D = D(end:-1:1,end:-1:1)
>
> ... or, yet another solution
>
> D=rot90(D,2)
>
> us

Subject: Eigen value and Eigen vector?

From: Titus

Date: 17 Aug, 2007 15:18:49

Message: 6 of 7


"stephen " <huangj5@nationwide.com> schrieb im Newsbeitrag
news:fa4a5e$35c$1@fred.mathworks.com...
> Thanks for all the responses, guys.
>
> I am a little confused now as I look at the results. I
> have an Excel VBA program which could calculate the
> Eigenvalues in descending order and the associated
> Eigenvetors. If I use the suggested method to calculate
> the same things in Matlab, some values of Eigenvector are
> exactly the same while some values of Eigenvector are the
> same in absolute terms but have opposite signs (plus vs
> minus). I use formula V*D*V’ to check if they are getting
> the same correlation matrix, and they are.
>
> Does anyone have any idea what’s going on here?
>
> Thanks,
> Stephen
>
>
>
>
> "us " <us@neurol.unizh.ch> wrote in message
> <fa3kac$rlr$1@fred.mathworks.com>...
>> Titus:
>> <SNIP the big easy...
>>
>> > > D = D(length(D(1,:)):-1:1,length(D(:,1)):-1:1) ;
>>
>> > slightly easier: use "end" instead of length:
>> > D = D(end:-1:1,end:-1:1)
>>
>> ... or, yet another solution
>>
>> D=rot90(D,2)
>>
>> us
>

Hi Stephen,
yes I have ;-)
Eigenvectors are not unique in the following sense: if x is an eigenvector,
k*x for every k~=0 is an eigenvector as well, since an eigenvector is a non
trivial vector that solves
A * x = lambda * x
so: for any scalar k~=0
A * (k*x) = k * (A * x) = k * (lambda * x) = lambda * (k * x),
so k*x is an eigenvector as well, especially for k=-1...

Titus


Subject: Eigen value and Eigen vector?

From: Greg Heath

Date: 17 Aug, 2007 16:57:31

Message: 7 of 7

On Aug 16, 4:20 pm, "stephen " <huan...@nationwide.com> wrote:
> Hi,
>
> Matlab function [V,D]=eig() would generate eigenvalues in
> ascending order and the associated eigenvectors.
>
> Is there an easy way to generate eigenvalues and
> associated eigenvectors in descending order?

1. Use EIGS instead of EIG
2. Use FLIPLR and FLIPUD

Hope this helps.

Greg


Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

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.

Tag Activity for This Thread
Tag Applied By Date/Time
code us 17 Aug, 2007 04:00:15
rot90 us 17 Aug, 2007 04:00:15
matrix us 17 Aug, 2007 04:00:15
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com