filmov
tv
Matlab - 3D Plot Functions of Two Variables

Показать описание
Thanks for watching
CODE:
%---------3D plots---------
%--------- z=f(x,y)--------
f = @(x,y) sin (3*x+2*y)
stepsize=0.1;
[X,Y] = meshgrid(0:stepsize:4);
Z=f(X,Y);
%%
h=surf(X,Y,Z);
title('sin(3x+2y)')
xlabel('x')
ylabel('y')
zlabel('z')
%set(h,'LineStyle','none');
%set(h,'FaceColor','g');
%%---------------------------------------------------------------
%f = @(x,y) sin (3*x+2*y)
% h=ezsurf(f,[0,4])
% h=ezsurf(f,[-1,1],'circ')
%% 'circ' is very useful to plot functions with cylindrical of spherical %%symmetry
CODE:
%---------3D plots---------
%--------- z=f(x,y)--------
f = @(x,y) sin (3*x+2*y)
stepsize=0.1;
[X,Y] = meshgrid(0:stepsize:4);
Z=f(X,Y);
%%
h=surf(X,Y,Z);
title('sin(3x+2y)')
xlabel('x')
ylabel('y')
zlabel('z')
%set(h,'LineStyle','none');
%set(h,'FaceColor','g');
%%---------------------------------------------------------------
%f = @(x,y) sin (3*x+2*y)
% h=ezsurf(f,[0,4])
% h=ezsurf(f,[-1,1],'circ')
%% 'circ' is very useful to plot functions with cylindrical of spherical %%symmetry