Question

How to plot a three-dimensional surface from a function f(x,y) en 3D with Matlab?


Annonce
Ad

Answer

% X => [0 : 0.05 :1]
% Y => [0 : 0.04 :2]
[X,Y] = meshgrid(0:0.05:1,0:0.04:2);
% Function to display Z(x,y)=f(x,y)
Z = sin(10*X) + cos(10*Y);
% Display
surf(X,Y,Z);
% Axis labels
xlabel ('X');
ylabel ('Y');
                


[source]
# ID Query