Number of sample points
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
UMesh etc. determine the number
of sample points used for the numerical approximation of parameterized
plot objects such as curves and surfaces.
Many plot objects have to be evaluated numerically on a discrete mesh. The attributes described on this help page serve for setting the number of sample points of the numerical mesh.
For curves in 2D and 3D given by a parametrization x(u), y(u) and,
possibly, z(u) with
the curve parameter u,
UMesh = n creates a numerical mesh
of n equidistant u values.
USubmesh = m inserts additional m mesh
points between each pair of adjacent points set by
UMesh = n,
= m and
UMesh = (m + 1) (n - 1) + 1,
= 0 are equivalent.
The sample points of a curve can be made visible by setting
Surface objects in 3D are parameterized by coordinate functions x(u, v), y(u, v), z(u, v) of two surface parameters u, v.
UMesh = nu sets
the number nu of
sample points for the first surface parameter. The attribute
= nv sets the number nv of
sample points for the second surface parameter. The parametrization
is evaluated on a regular mesh of nu×nv values
of the surface parameters u, v.
additional equidistant sample points can be inserted between each
pair of adjacent sample points set by the
ULinesVisible = TRUE and
= TRUE, respectively, the parameter lines of the regular
mesh set by the attributes
displayed on the surface. Additonal points inserted via
VSubmesh do not create
additional parameter lines.
If adaptive sampling is
enabled, further non-equidistant sample points are chosen automatically
between the equidistant points of the `initial mesh' set via the
USubmesh, VMesh, VSubmesh attributes.
It is possible to use low settings of mesh parameters to achieve special effects. As an example, we draw a parametrization of a circle with just six evaluation points:
plot(plot::Curve2d([cos(t), sin(t)], t = 0..2*PI, UMesh = 6, Scaling = Constrained))
The reason we get a pentagon here and not a hexagon is that the first and the last evaluation points coincide: six points in a line means five line segments.
UMesh = 30, the circle looks like a
plot(plot::Curve2d([cos(t), sin(t)], t = 0..2*PI, UMesh = 30, Scaling = Constrained))
The default values of
not provide a sufficient resolution for the following graphics:
plot(plot::Surface([r*cos(phi), r*sin(phi), r*phi], r = 0.. 1, phi = 0..10*PI)):
The spiral winds around the z-axis
5 times. We wish to have approximately 40 sample points per revolution,
so we need to use a total of 200 sample points with respect to the
phi. The coordinate lines related
to the radial parameter
r are straight lines, so
a very low resolution in this direction suffices:
plot(plot::Surface([r*cos(phi), r*sin(phi), r*phi], r = 0.. 1, phi = 0..10*PI, UMesh = 2, VMesh = 200)):
When refining the mesh via
VSubmesh, no additional
parameter lines are created:
plot(plot::Surface([r*cos(phi), r*sin(phi), r*phi], r = 0.. 1, phi = 0..10*PI, UMesh = 2, VMesh = 25, VSubmesh = 8)):