0

How to sort vector e and matrix v together, that we have to respect: each eigenvalue coresponds to eigenvector in matrix v, like in the picture.

v =

 0.9978 + 0.0022i   0.9978 - 0.0022i   0.9179 - 0.0199i   0.9179 + 0.0199i
-0.4665 + 0.0050i  -0.4665 - 0.0050i   0.9805 - 0.0195i   0.9805 + 0.0195i
-0.0003 - 0.0025i  -0.0003 + 0.0025i  -0.0008 - 0.0162i  -0.0008 + 0.0162i
 0.0001 + 0.0012i   0.0001 - 0.0012i  -0.0008 - 0.0173i  -0.0008 + 0.0173i

So we can say that for example eigenvalue e(1,1) corespond to eigenvector v(:,1). In the picture are vector e_sort and matrix v_sort in specific order, that I need it.

enter image description here

The rule is for vector e: First must be:

 -a+b*i

and then:

 -a-b*i

We can say, that:

  0 < b_1 < b_2 < ... < b_n

Thanks.

MrPitivier
  • 71
  • 9
  • It is similar, but expanded, question like that: http://stackoverflow.com/questions/27090398/sort-complex-vectors-in-specific-order – MrPitivier Nov 23 '14 at 19:50

1 Answers1

0

Answer is also very similar :)

negIm = imag(e) < 0;
[e1,ie1] = sort(e(~negIm));
[e2,ie2] = sort(e(negIm));
newe = cat(1,e1,e2);

v1 = v(:,~negIm); v2 = v(:,negIm);
newv = cat(2,v1(:,ie1),v2(:,ie2));
Kostya
  • 1,552
  • 1
  • 10
  • 16