www.gusucode.com > symbolic 源码程序 matlab案例代码 > symbolic/ControlResolutionOfSurfacePlotExample.m

    %% Control Resolution of Surface Plot
% Control the resolution of a surface plot 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
% parametric surface $x=\sin(s)$, $y=\cos(s)$, and
% $z=(t/10)\sin(1/s)$. The surface has a large gap. Fix this issue by increasing the 
% |'MeshDensity'| to |40| in the second subplot. |fsurf| fills the gap
% showing that by increasing |'MeshDensity'| you increased the plot's resolution.
syms s t

subplot(2,1,1)
fsurf(sin(s), cos(s), t/10.*sin(1./s))
view(-172,25)
title('Default MeshDensity = 35')

subplot(2,1,2)
fsurf(sin(s), cos(s), t/10.*sin(1./s),'MeshDensity',40)
view(-172,25)
title('Increased MeshDensity = 40')