Create a Matlab program that will generally translate using
Solution
(1)
A_r=1;
A_thet=pi/2;
A_phi=pi/2;
A_x=A_r*sin(A_thet)*cos(A_phi);
A_y=A_r*sin(A_thet)*sin(A_phi);
A_z=A_r*cos(A_thet);
fprintf(\'\ \\t A_x =%0.2f \\t A_y = %0.2f \\t A_z=%0.2f\ \',A_x,A_y,A_z);
OUTPUT:
A_x =0.00 A_y = 1.00 A_z=0.00
(2)
A_r=1;
A_thet=pi/2;
A_phi=pi;
A_x=A_r*sin(A_thet)*cos(A_phi);
A_y=A_r*sin(A_thet)*sin(A_phi);
A_z=A_r*cos(A_thet);
fprintf(\'\ \\t A_x =%0.2f \\t A_y = %0.2f \\t A_z=%0.2f\ \',A_x,A_y,A_z);
OUTPUT:
A_x =-1.00 A_y = 0.00 A_z=0.00
(3)
A_r=1;
A_thet=0;
A_phi=0;
A_x=A_r*sin(A_thet)*cos(A_phi);
A_y=A_r*sin(A_thet)*sin(A_phi);
A_z=A_r*cos(A_thet);
fprintf(\'\ \\t A_x =%0.2f \\t A_y = %0.2f \\t A_z=%0.2f\ \',A_x,A_y,A_z);
OUTPUT:
A_x =0.00 A_y = 0.00 A_z=1.00
(4)
A_r=1;
A_thet=pi/4;
A_phi=pi/4;
A_x=A_r*sin(A_thet)*cos(A_phi);
A_y=A_r*sin(A_thet)*sin(A_phi);
A_z=A_r*cos(A_thet);
fprintf(\'\ \\t A_x =%0.2f \\t A_y = %0.2f \\t A_z=%0.2f\ \',A_x,A_y,A_z);
OUTPUT:
A_x =0.50 A_y = 0.50 A_z=0.71

