%% Control Resolution of Plot
% Control the resolution of a plot 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 by using subplot. In the first subplot, plot a step function from x = 2.1 to x = 2.15. The plot's resolution is too low to detect the step function. Fix this issue by increasing MeshDensity to 39 in the second subplot. The plot now detects the step function and shows that by increasing MeshDensity you increased the plot's resolution.

syms x
stepFn = rectangularPulse(2.1, 2.15, x);

subplot(2,1,1)
fplot(stepFn);
title('Default MeshDensity = 23')

subplot(2,1,2)
fplot(stepFn,'MeshDensity',39);
title('Increased MeshDensity = 39')

% Copyright 2012 The MathWorks, Inc.