www.gusucode.com > graphics 案例源码程序 matlab代码 > graphics/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)$, $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 resolution. subplot(2,1,1) fsurf(@(s,t) sin(s), @(s,t) cos(s), @(s,t) t/10.*sin(1./s)) view(-172,25) title('Default MeshDensity = 35') subplot(2,1,2) fsurf(@(s,t) sin(s), @(s,t) cos(s), @(s,t) t/10.*sin(1./s),'MeshDensity',40) view(-172,25) title('Increased MeshDensity = 40')