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

    %% Specify Number of Contour Lines
% Store the data from the |peaks| function in matrices |X|, |Y|, and |Z|.
% Plot 20 contours of the data in |Z|.

% Copyright 2015 The MathWorks, Inc.


[X,Y,Z] = peaks;
figure
contour(X,Y,Z,20)