www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/Plot3DFunctionalSurfaceExample.m

    %% Plot 3-D Functional Surface
% 
%%
% Use |meshgrid| to create a gridded _(X,Y)_ domain.

% Copyright 2015 The MathWorks, Inc.

[X,Y] = meshgrid(-2:.2:2, -2:.2:2);  
%%
% Evaluate the function $z(x,y) = xe^{-x^2-y^2}$ over this domain and generate a
% surface plot of the results.
Z = X .* exp(-X.^2 - Y.^2);                                        
surf(X,Y,Z)