Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Matlab program that asks the user to enter the seven digits of the z-num

ID: 3559914 • Letter: W

Question

Write a Matlab program that asks the user to enter the seven digits of the z-number and define the positive number a as the range (difference between the maximum and minimum) of z . Then create x and y vectors from -a to +a with spacing 0.05. Use the meshgrid function to map x and y onto two new two-dimensional arrays called X and Y. Use your new arrays to calculate the vector Z, with magnitude. Z= sin(sqrt((x2+y2)))

Use the subplot function to generate the following 3D plots on one page:

(a) Use the plot3 function to create a three-dimensional plot of Z.

(b) Use the mesh function to create a three-dimensional plot of Z.

(c) Use the surf function to create a three-dimensional plot of Z.

(d) Use the contour function to create a three-dimensional plot of Z.

(e) Generate a combination of surface and contour plot of Z.

Don

Explanation / Answer

v1=input('Enter 1st number: ');
v2=input('Enter 2nd number: ');
v3=input('Enter 3rd number: ');
v4=input('Enter 4th number: ');
v5=input('Enter 5th number: ');
v6=input('Enter 6th number: ');
v7=input('Enter 7th number: ');
z=[v1,v2,v3,v4,v5,v6,v7];

a=max(z)-min(z);
x=-a:0.05:a;
y=-a:0.05:a;
[X Y]=meshgrid(x,y);
f=@(X,Y) sin(sqrt(X.^2+Y.^2));
Z=f(X,Y);
%plot3(X,Y,Z)


subplot(2,3,1)
plot3(X,Y,Z);
xlabel('X')
ylabel('Y')
zlabel('Z')
title('Using plot3');

subplot(2,3,2)
mesh(X,Y,Z)
xlabel('X')
ylabel('Y')
zlabel('Z')
title('Using mesh')

subplot(2,3,3)
surf(X,Y,Z)
xlabel('X')
ylabel('Y')
zlabel('Z')
title('Using surf')

subplot(2,3,4)
contour(X,Y,Z)
xlabel('X')
ylabel('Y')
zlabel('z')
title('Using Contour')

subplot(2,3,5)
surfc(X,Y,Z)
xlabel('X')
ylabel('Y')
zlabel('Z')
title('Surfce and contour plot')

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote