How do i convert from Complex numbers(a+bi) to a polar form(r,theta) ?

914 Ansichten (letzte 30 Tage)
Pradeep Suresh
Pradeep Suresh am 25 Jan. 2014
Beantwortet: Youssef Sherif am 1 Apr. 2023
I am writing a script for my microwave amplifier design . I need to convert from the polar form to complex numbers and vice versa . Does Matlab support this function ?
Thank you.

Antworten (3)

Azzi Abdelmalek
Azzi Abdelmalek am 25 Jan. 2014
x=2+3j
rho=abs(x)
theta=angle(x)
%-------------------
x=rho*exp(j*theta)
  1 Kommentar
Xuanjun Gong
Xuanjun Gong am 30 Mär. 2020
There is an error for using rho*exp(j*theta) about dimensionality.
It might solve the issue by using:
`x=rho.*exp(j*theta)`

Melden Sie sich an, um zu kommentieren.


Mischa Kim
Mischa Kim am 25 Jan. 2014
Bearbeitet: Mischa Kim am 25 Jan. 2014
Hello Pradeep, use http://www.mathworks.com/help/matlab/ref/cart2pol.html. You can also find the reverse transformation there.
a = 1 + 2i;
[theta, rho] = cart2pol(real(a), imag(a))
  4 Kommentare
Felicia Chiew Pei Wan
Felicia Chiew Pei Wan am 10 Feb. 2015
Bearbeitet: Felicia Chiew Pei Wan am 10 Feb. 2015
I can display the s-parameters in a+bi form. However, I would like to convert it to polar form with this kind of arrangements.
Arrangement (in polar form) S11 S21 (S11 AND S22 IN SAME LINE) S12 S22(S12 AND S22 IN NEXT LINE)
On the other hand, "[theta, rho] = cart2pol(real(a), imag(a))". Based on this command, the angle we got is not right. Have to multiple by 180/pi. Any idea on this? Thank you.
Stephen23
Stephen23 am 10 Feb. 2015
"Based on this command, the angle we got is not right": actually this angle is perfectly correct, according to the cart2pol documentation. If you want to convert correct and documented radians to some other angle unit, then this is up to you.

Melden Sie sich an, um zu kommentieren.


Youssef Sherif
Youssef Sherif am 1 Apr. 2023
Io_polar = sprintf('Io_polar = %.3f ∠ %.3f°', abs(Is(1,1)), rad2deg(angle(Is(1,1))))

Kategorien

Mehr zu Polar Plots 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