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

    %% Create 3-D Contour Plot
% Set up matrices |X| and |Y| using the |meshgrid| function. Plot 30
% contours of matrix |Z|.

% Copyright 2015 The MathWorks, Inc.


x = -2:0.25:2;
[X,Y] = meshgrid(x);
Z = X.*exp(-X.^2-Y.^2);
contour3(X,Y,Z,30)