This programming problem will compare the surf(...) and mesh(...) functions by p
ID: 1856779 • Letter: T
Question
This programming problem will compare the surf(...) and mesh(...) functions by putting two 3-D side by side plots for comparison using subplot(...). You should label all axes accordingly ('x-axis', 'y-axis', etc) and title your plot corresponding to the problem statement. a.On the left side, plot the function f(x,y) = x.^2 .* cos(y) in the range x = -5:5 and y = -5:5 using mesh. Name your plot 'Using Mesh'. b.On the right side, plot the same function, in the same range, but using surf. Name your plot 'Using Surf'Explanation / Answer
x = -5:5
y = -5:5
[xx, yy]= meshgrid(x,y);
zz=(xx.^2).*cos(yy);
subplot(1,2,1) mesh(xx,yy,zz) xlabel('x-axis') ylabel ('y-axis') zlabel ('z-axis')
subplot(1,2,2) surf(xx,yy,zz) xlabel ('x-axis') ylabel ('y-axis') zlabel ('z-axis')
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.