# Solved: For the following two-variable function: z = 2x sin(x) + xy cos(2y) i. Plot a 3D mesh for z, for the range: -2 lessthanorequalto x lessthanorequalto

Display it using matlab

For the following two-variable function: z = 2x sin(x) + xy cos(2y) i. Plot a 3D mesh for z, for the range: -2 lessthanorequalto x lessthanorequalto 2 and -3 lessthanorequalto y lessthanorequalto 3 in steps of 0.1, and add labels for all axes. ii. Find the minimum and maximum values of z. iii. Use contour plots to find two different values for (x, y), when z- = +1. iv. Plot a 2 times 2 mesh graph array showing the cross sections x-y, x-z, y-z, in graphs (1), (2), and (3), respectively, while the 3D x-y-z in graph (4). Add labels and titles. v. Use MATLAB help to display the contour lines for z = 0, 1 and 4 only, while showing the values of the contour levels for x greaterthanorequalto 0, y greaterthanorequalto 0.

Don't use plagiarized sources. Get Your Custom Essay on
Solved: For the following two-variable function: z = 2x sin(x) + xy cos(2y) i. Plot a 3D mesh for z, for the range: -2 lessthanorequalto x lessthanorequalto
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE

Executable code

%Declare and initialize intervals
xInterval = -2:1:2;
yInterval = -3:1:3;

%Mesh grid
[xValue,yValue] = meshgrid(xInterval,yInterval);

%Given function
zValue = (2.*xValue.*sin(xValue)) + (xValue.*yValue.*cos(2.*yValue));

%3D Mesh
mesh(xValue,yValue,zValue)

%Label the axis
xlabel(‘x axis’)

%Label the axis
ylabel(‘y axis’)

%Label the axis
zlabel(‘z axis’)

%Find minimum value
minvalueofZ = min(min(zValue))

%Find maximum value
maxvalueofZ = max(max(zValue))

%Hold on
hold on

%Coutour
contour(xValue,yValue,zValue)

%Hold on
hold on