Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

1/19/23 2:09 PM C:\Users\ESSIEN\Documents...\Matrix_HND1.

m 1 of 1

%MATLAB program for comlex number operation


clear
clc
R1=4;
theta1=pi/3;
[X1,Y1]=pol2cart(theta1,R1);
fprintf('Z1=%.2f %+.2fj\n',X1,Y1)
R2=9;
theta2=(-5*pi/4);
[X2,Y2]=pol2cart(theta2,R2);
fprintf('Z2=%.2f %+.2fj\n',X2,Y2)
R3=1;
theta3=(9*pi/5);
[X3,Y3]=pol2cart(theta3,R3);
fprintf('Z3=%.2f %+.2fj\n',X3,Y3)
X4=(sqrt(3)/2);
Y4=-1/2;
[theta4,R4]=cart2pol(X4,Y4);
fprintf('r4=%.2f,THETA4=%.2frads,THETADEG=%.2f°\n',R4,theta4,(theta4*(180/pi)))
X5=1;
Y5=sqrt(3);
[theta5,R5]=cart2pol(X5,Y5);
fprintf('r5=%.2f,THETA5=%.2frads,THETADEG5=%.2f°\n',R5,theta5,(theta5*(180/pi)))

You might also like