USING MATLAB
Unless previously re-defined, MATLAB
recognizes “i” or “j” as imaginary units
» z2=3+4j
z2 =
   3.0000 + 4.0000i
» z1=4+6i
z1 =
   4.0000 + 6.0000i
In its output MATLAB always uses “i” for
the imaginary unit
MATLAB recognizes complex numbers
in rectangular representation. It does
NOT recognize Phasors
» a=45; % angle in degrees
» ar=a*pi/180, %convert degrees to radians
ar =
    0.7854
» m=10; %define magnitude
» x=m*cos(ar); %real part
x =
    7.0711
» y=m*sin(ar); %imaginary part
y =
    7.0711
» z=x+i*y
z =
   7.0711 + 7.0711i
z =  7.0711 + 7.0711i;
» mp=abs(z); %compute magnitude
mp =
    10
» arr=angle(z); %compute angle in RADIANS
arr =
0.7854
» adeg=arr*180/pi; %convert to degres
adeg =
    45
x=real(z)
x=
   7.0711
y=imag(z)
y=
   7.70711