Write a MATLAB m file to plot the 3-D curve represented by a multivariable function z(x,y) = x2 −0.5y2 over x ∈ [−2,2] and y ∈ [−2,2]. Use a 2 point thickness. For both x an
y axes, choose the grid size to be 0.05. Clearly label and title your plot. Rotate the view at an azymuth of −20 , and elevation of 20 .
You need to use the following commands: x=-2:0.05:2; y=x; z=x.^2-0.5*y.^2;
plot3(x,y,z,’LineWidth’,2)
label(’ My 3D curve’); xlabel(’\it x’);ylabel(’\it y’)
view(-20,20)
include the MATLAB code in the response.
The code is correct. Just instead of label(’ My 3D curve’), title('My 3D curve') should be used.
CODE:
clear all; close all; clc;
x=-2:0.05:2;
y=x;
z=x.^2-0.5*y.^2;
plot3(x,y,z,'LineWidth',2)
title('My 3D curve');
xlabel('\it x');
ylabel('\it y')
view(-20,20)
Get Answers For Free
Most questions answered within 1 hours.