sort output of roots or residue so that the repeated roots occur together
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
The output of the roots command come out in complex conjugate pairs.
e.g.
roots([1 8 38 88 121])
ans =
-2.0000 + 2.6458i
-2.0000 - 2.6458i
-2.0000 + 2.6458i
-2.0000 - 2.6458i
I want it to come out as:
-2.0000 + 2.6458i
-2.0000 + 2.6458i
-2.0000 - 2.6458i
-2.0000 - 2.6458i
so that I can algorithmically recognize repeated roots.
(The roots command used to do this. The current output is not an improvement>)
Please advise!
Dr. Vallorie Peridier, Temple University
0 Commenti
Risposte (1)
KALYAN ACHARJYA
il 30 Ago 2021
Modificato: KALYAN ACHARJYA
il 30 Ago 2021
>> data=roots([1 8 38 88 121])
data =
-2.0000 + 2.6458i
-2.0000 - 2.6458i
-2.0000 + 2.6458i
-2.0000 - 2.6458i
>> result=sort([real(data) imag(data)],'descend')*[1;1i]
result=
-2.0000 + 2.6458i
-2.0000 + 2.6458i
-2.0000 - 2.6458i
-2.0000 - 2.6458i
>>
0 Commenti
Vedere anche
Categorie
Scopri di più su Shifting and Sorting Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!