%% 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.
% Create two plots in a tiled chart layout. In the first plot, display 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 plot. fsurf fills the gap, showing that by increasing 'MeshDensity' you increased the resolution.

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

nexttile
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')

% Copyright 2019 The MathWorks, Inc.