From: Ben Williams on
Hi everybody,
I'm trying to calculate eigenvalues and relative eigenvectors in decreasing order?

I've used [V,D] = EIG(X) command, but the order is different from what I need.

For example, if I type
>> [A,B] = eig([2 0 0; 0 1 0; 0 0 7])
it assigns

A =

0 1 0
1 0 0
0 0 1


B =

1 0 0
0 2 0
0 0 7

but I wanted 7 -> 2 -> 1 order!

Any suggestions?
thanks in advance!
From: Rune Allnor on
On 27 Sep, 18:31, "Ben Williams" <super...(a)gmail.com> wrote:
> Hi everybody,
> I'm trying to calculate eigenvalues and relative eigenvectors in decreasing order?
>
> I've used [V,D] = EIG(X) command, but the order is different from what I need.
>
> For example, if I type>> [A,B] = eig([2 0 0; 0 1 0; 0 0 7])
>
> it assigns
>
> A =
>
>      0     1     0
>      1     0     0
>      0     0     1
>
> B =
>
>      1     0     0
>      0     2     0
>      0     0     7
>
> but I wanted 7 -> 2 -> 1 order!
>
> Any suggestions?
> thanks in advance!

Sort the eigenvalues.

Rune
From: Ben Williams on
Ok, but then i need the eigenvector in the right order too.. how can i obtain this?

> Sort the eigenvalues.
>
> Rune
From: Rune Allnor on
On 27 Sep, 18:49, "Ben Williams" <super...(a)gmail.com> wrote:
> Ok, but then i need the eigenvector in the right order too.. how can i obtain this?

doc sort

Rune
From: Ben Williams on
ehi runa, are you joking?
i know how to sort a vector, but if i sort the eigenvalues vector i loose the correspondencewith the eigenvectors matrix.

so, does someone knows a solution?