Any complex number z = a + bi can be thought of as a point (a,b) or vector in the complex plane in which the horizontal axis is the real part of z, and the vertical axis is an imaginary part of z. Therefore, a and b are the Cartesian or rectangular coordinates. As a vector can be presented by either it's rectangular or polar coordinates, a complex number can be given also by its polar coordinates r and θ, here r is the magnitude of the vector and θ is an angle.
To convert from the polar coordinates into the rectangular coordinates:
a = r cos θ
b = r sin θ
To convert from the rectangular into polar coordinates:
Therefore, a complex number z = a + bi can be written as r cos θ + (r sin θ )i, or z = r (cos θ + i sin θ )
As ei θ = cos θ + i sin θ , a complex number can also be written as z = rei θ. In MATLAB, r can be found by using the abs function, and there is a special built-in function to find θ, known as angle.
>> z1 = 3 + 4i;
r = abs(z1)
>> theta = angle(z1)
3.0000 + 4.0000i