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

    %% Create Contour Plot
% Use the |meshgrid| function to generate matrices |X| and |Y|.  Create a 
% third matrix, |Z|, and plot its contours.

% Copyright 2015 The MathWorks, Inc.


x = linspace(-2*pi,2*pi);
y = linspace(0,4*pi);
[X,Y] = meshgrid(x,y);
Z = sin(X)+cos(Y);

figure
contour(X,Y,Z)