How to eliminate numbers without imaginary part?

1 Ansicht (letzte 30 Tage)
Ko Fa
Ko Fa am 6 Jan. 2021
Kommentiert: Ko Fa am 6 Jan. 2021
I am trying to keep just the complex numbers.
a =[
2.70810968
2.45396925
1.13928251
-4.04946201
0.8829 - 0.13089*i
0.1308*i + 0.8829
0.15285*i - 2.00890
-0.1528510*i - 2.0089069]
Thanks for any help

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 6 Jan. 2021
format long g
a =[
2.70810968
2.45396925
1.13928251
-4.04946201
0.8829 - 0.13089*i
0.1308*i + 0.8829
0.15285*i - 2.00890
-0.1528510*i - 2.0089069]
a = 8×1
2.70810968 + 0i 2.45396925 + 0i 1.13928251 + 0i -4.04946201 + 0i 0.8829 - 0.13089i 0.8829 + 0.1308i -2.0089 + 0.15285i -2.0089069 - 0.152851i
b = a(imag(a) ~= 0)
b = 4×1
0.8829 - 0.13089i 0.8829 + 0.1308i -2.0089 + 0.15285i -2.0089069 - 0.152851i

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by