XMesh
, XSubmesh
, YMesh
, YSubmesh
, ZMesh
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.
XMesh , XSubmesh , YMesh , YSubmesh , ZMesh  Inherited  Positive integer 
Objects  Default Values 

plot::Function2d 

plot::Function3d 

plot::Implicit2d , plot::Raster , plot::VectorField2d 

plot::Implicit3d 

plot::VectorField3d 

plot::Conformal 

plot::Inequality 

plot::Density 

plot::Matrixplot 

plot::Listplot 

The attributes XMesh
etc. determine the number
of sample points used for the numerical approximation of plot objects
such as function graphs, implicit plots etc.
Various object types use numerical function evaluations on a
discrete equidistant mesh. XMesh
, YMesh
,
and for plot::Implicit3d
also ZMesh
set
the number of points of this mesh. An exception of this are parameterized
curves and surfaces, which use the attributes UMesh
, USubmesh
, VMesh
,
and VSubmesh
.
For most of the object types listed above, the interpretation
of the integers set by these attributes is as follows: In each of XRange
, YRange
, ZRange
,
the corresponding number of points is spread out equidistantly. For XMesh
= 2
and XRange = 0..1
, for example, evaluation
takes place for x = 0 and x =
1. For XMesh = 3
, a further
mesh point at is
used.
The exception to this rule is plot::Implicit2d
: Here,
the values of XMesh
and YMesh
determine
the density of the grid usd for finding components and
increasing their values helps exactly in those cases where components
(i.e., lines) are missing from the plot. Decreasing XMesh
and YMesh
in
a 2D implicit plot will not make the curves appear rougher; it may
result in curves missing.
For types reacting to AdaptiveMesh
and for plot::Implicit3d
,
this mesh is used to find initial values that
can be refined further. See the documentation of the specific types
and of AdaptiveMesh
for
details.
In general, a finer mesh (higher values) leads to a longer computation, while a coarser mesh may cause details being missed.
One may specify XMesh
= n_{x}
, YMesh
= n_{y}
, XSubmesh
= m_{x}
, YSubmesh
= m_{v}
also
in the shorter Form Mesh
= [n_{x},
n_{y}]
, Submesh
= [m_{x},
m_{y}]
.
The notorious function oscillates wildly near the origin. The standard mesh values do not suffice to resolve the behavior of the function near the critical point:
plot(plot::Function2d(sin(1/x), x = 1 .. 1))
We get a better result with an increased value of XMesh
:
plot(plot::Function2d(sin(1/x), x = 1 .. 1), XMesh = 1000)
In the following plot, the default values of XMesh
, YMesh
do
not suffice to produce a sufficiently smooth function graph:
plot(plot::Function3d(besselJ(0, sqrt(x^2 + y^2)), x = 20 .. 20, y = 20 .. 20)):
Increasing the default values XSubmesh = 0
, YSubmesh
= 0
yields a higher resolution plot. Note that this does
not influence the number of mesh lines that are displayed:
plot(plot::Function3d(besselJ(0, sqrt(x^2 + y^2)), x = 20 .. 20, y = 20 .. 20, XSubmesh = 2, YSubmesh = 2)):
Alternatively, we increase the values of XMesh
, YMesh
and
use the default values XSubmesh = 0
, YSubmesh
= 0
. This, however, increases the number of mesh lines that
are displayed:
plot(plot::Function3d(besselJ(0, sqrt(x^2 + y^2)), x = 20 .. 20, y = 20 .. 20, XMesh = 73, YMesh = 73)):
Yet another possibility is to use the default values of XMesh
, YMesh
, XSubmesh
, YSubmesh
and
activate the adaptive mechanism to
smoothen the critical regions of the plot. However, this plot consists
almost completely of critical regions and the adaptive mechanism will
therefore be slower than a direct calculation with a finer mesh that
leads to almost the same result:
plot(plot::Function3d(besselJ(0, sqrt(x^2 + y^2)), x = 20 .. 20, y = 20 .. 20, AdaptiveMesh = 2)):
For twodimensional implicit plots, XMesh
and YMesh
determine
the mesh of “seed points” that are used to find components
(see the documentation of plot::Implicit2d
for more details).
In effect, this means that if some components are missing from a plot,
the values of these attributes should be increased:
plot(plot::Implicit2d(sin(2*x*y), x = 3..3, y = 3..3))
plot(plot::Implicit2d(sin(2*x*y), x = 3..3, y = 3..3, XMesh = 20, YMesh = 20))