Create a 1 x n (n > 60) matrix A filled with numbers in the range -n to n. Creat
ID: 1715116 • Letter: C
Question
Create a 1 x n (n > 60) matrix A filled with numbers in the range -n to n. Create a new matrix B in which each element is the tangent of the corresponding element in matrix A. Plot B vs. A in subplot 1, grid on, please include axis labels, title and legend in the plot. Now, create a matrix C in which each element is the arc-cotangent of the corresponding element in matrix B. Plot C vs. A in subplot 2, grid off, please include axis labels, title and legend in the plot. Finally, create a matrix D in which each element in matrix C, which has each angle value expressed in radians, is converted to the corresponding angle value expressed in degrees using the relationship that n radians equal 180 degree.Explanation / Answer
%let n=70
a=-pi
b=pi
q=0:1/70:1
A=a + (b-a).*q% a)A matrix
B=tan(A) %b) B matrix
subplot(2,1,1)
plot(A,B);xlabel('A');ylabel('B');title('B vs A');legend('B=tan(A)')
grid on;
C=atan(B) %b) C matrix
subplot(2,1,2)
plot(A,C);xlabel('A');ylabel('C');title('C vs A');legend('C=tan^-1(A)')
grid off;
D=(180/pi)*C %D matrix