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

    %% Surface Plot of Peaks Function
% Use the |peaks| function to define |X|, |Y|, and |Z| as 25-by-25 matrices. Then,
% create a surface plot.

% Copyright 2015 The MathWorks, Inc.


[X,Y,Z] = peaks(25);

figure
surf(X,Y,Z);

%%
% |surf| creates the surface plot from corresponding values in |X|, |Y|, and
% |Z|. If you do not define the color data |C|, then |surf| uses |Z| to determine the color, so color is
% proportional to surface height.