# Complex number to polar form

66 ビュー (過去 30 日間)
Tobias Ottsen 2020 年 10 月 20 日

Hi
How do i calculate this complex number to polar form?
z = (10<-50)*(-7+j10) / -12*e^-j45*(8-j12)

サインインしてコメントする。

### 回答 (3 件)

Ameer Hamza 2020 年 10 月 20 日
The number you wrote in not correct according to MATLAB syntax. You can use abs() and phase() to convert complex numbers to polar coordinate
z = 2 + 3j;
r = abs(z);
angle = phase(z);

#### 0 件のコメント

サインインしてコメントする。

Star Strider 2020 年 10 月 20 日
Use the abs (magnitude) and angle (radian phase angle) functions.
The phasor notation for it would be:
phasor = [abs(z) angle(z)]
However you cannot calculate anything until you resolve the problem:
z = (10<-50)*(-7+j10) / -12*exp(-j45*(8-j12))
↑ ← HERE
That is not valid MATLAB code. (I also corrected the ‘e^’ notation for the exponential function.)
(Another problem is ‘j10’, ‘j45’ and ‘j12’. I am not certain what they are, however using numbered variables such as these is generally considered poor programming practice. Put them in a vector and reference them as elements of the vector.)

#### 2 件のコメント

Tobias Ottsen 2020 年 10 月 20 日
z = (10<-50)*(-7+i10) / -12*exp(-i45)*(8-i12)) This maybe the right syntax. I use J instead of i ;). I just need to se a method to calculate it
Star Strider 2020 年 10 月 20 日
I posted the way to calculate it as:
phasor = [abs(z) angle(z)]
or in function form:
phasor = @(z) [abs(z) angle(z)];
If you want to use ‘i’ or ‘j’ as imaginary operators, the number has to precede the ‘i’ or ‘j’, so 45j is evaluated as 0 + 45i. I believe this is what you want.
The problem is still the ‘less than’ (<) sign in the ‘z’ calculation that I pointed out (with arrows ↑← !) in my original Answer. That is not correct MATLAB syntax, and will throw an error, so you cannot calculate anything until you correct it. I have no idea what you want to do there, so I am only suggesting that you eliminate the (<).

サインインしてコメントする。

Steven Lord 2020 年 10 月 20 日
Use pol2cart and cart2pol to convert between the (r, theta) and (real, imag) representations of the complex numbers. Since I'm guessing your angles are in degrees you'll also need deg2rad and rad2deg.

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!

Translated by