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

    %% Control Resolution of Contour Lines
% Control the resolution of contour lines by using the |'MeshDensity'|
% option. Increasing |'MeshDensity'| can make smoother, more accurate
% plots, while decreasing it can increase plotting speed.
% 
% Divide a figure into two using |subplot|. In the first subplot, plot the
% contours of $\sin(x)\sin(y)$. The corners of the squares do not meet. To
% fix this issue, increase |'MeshDensity'| to |200| in the second subplot.
% The corners now meet, showing that by increasing |'MeshDensity'| you
% increase the resolution.

f = @(x,y) sin(x).*sin(y);
subplot(2,1,1)
fcontour(f)
title('Default Mesh Density (71)')

subplot(2,1,2)
fcontour(f,'MeshDensity',200)
title('Custom Mesh Density (200)')