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

[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)

% Copyright 2015 The MathWorks, Inc.