0

I have vector with eigenvalues:

e = 

-0.4094 + 3.9387i
-0.4094 - 3.9387i
-0.0156 + 0.5645i
-0.0156 - 0.5645i

And I would like to sort this vector like that:

e_sort =

-0.0156 + 0.5645i
-0.4094 + 3.9387i
-0.0156 - 0.5645i
-0.4094 - 3.9387i

The rule is: First must be:

 -a+b*i

and then:

 -a-b*i

We can say, that:

  0 < b_1 < b_2 < ... < b_n

Thanks,

Rashid
  • 4,326
  • 2
  • 29
  • 54
MrPitivier
  • 71
  • 9

1 Answers1

1
e1 = e(imag(e) >= 0);
e2 = e(imag(e) < 0);
newe = cat(1,sort(e1),sort(e2))

newe =

-0.0156 + 0.5645i
-0.4094 + 3.9387i
-0.0156 - 0.5645i
-0.4094 - 3.9387i
Rashid
  • 4,326
  • 2
  • 29
  • 54