plot z=cos(x/y)*cos(y)+(y/10)-(x/5) in matlab in matlab

To plot a 3D surface of the function z=cos(x/y)*cos(y)+(y/10)-(x/5) in matlab, you would need to define a range of x and y values using meshgrid and compute the corresponding z values. Then, you can plot the resulting surface using the surf function.

Here's the code:

main.m
% Define the range of x and y values
x = linspace(-10, 10);
y = linspace(-10, 10);
[X,Y] = meshgrid(x,y);

% Compute the corresponding z values
Z = cos(X./Y).*cos(Y)+(Y./10)-(X./5);

% Plot the surface
surf(X,Y,Z)
title('z = cos(x/y)*cos(y)+(y/10)-(x/5)')
xlabel('x')
ylabel('y')
zlabel('z')
292 chars
15 lines

This should give you a 3D surface plot of the function.

gistlibby LogSnag