convert real numbers to img form
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
hi.i have real number which i want to convert t img form. how can i do this?
e.g: 8 to 8i
tnx
0 Kommentare
Antworten (1)
Chunru
am 26 Nov. 2021
a = 8
b = a*1i % method 1
c = complex(0, a) % method 2
1 Kommentar
John D'Errico
am 26 Nov. 2021
Bearbeitet: John D'Errico
am 26 Nov. 2021
+1 of course, as this seems to cover the bases completely.
I would only add that MATLAB does not have a purely imaginary form, only a complex form. Since the OP seems to be hoping to see a number of the form 8i, they may become confused when seeing a zero real part displayed. If the real part is zero, then the result is purely imaginary.
Siehe auch
Kategorien
Mehr zu Dates and Time 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!