Plot 3-D mesh
fmesh(
creates a
mesh plot of the symbolic expression f
)f(x,y)
over
the default interval [-5 5]
for x
and y
.
fmesh(
plots f
,[xmin xmax
ymin ymax]
)f(x,y)
over the interval [xmin xmax]
for x
and [ymin ymax]
for
y
. The fmesh
function uses
symvar
to order the variables and assign intervals.
fmesh(
plots
the parametric mesh funx,funy,funz
)x = x(u,v)
, y = y(u,v)
, z
= z(u,v)
over the interval [-5 5]
for u
and v
.
fmesh(
plots the parametric mesh funx,funy,funz
,[uvmin
uvmax]
)x
= x(u,v)
, y = y(u,v)
, z = z(u,v)
over
the interval [uvmin uvmax]
for u
and v
.
fmesh(
plots the parametric mesh funx,funy,funz
,[umin
umax vmin vmax]
)x = x(u,v)
, y =
y(u,v)
, z = z(u,v)
over the interval
[umin umax]
for u
and [vmin
vmax]
for v
. The fmesh
function uses
symvar
to order the parametric variables and assign intervals.
fmesh(___,
uses
the LineSpec
)LineSpec
to set the line style, marker symbol,
and plot color.
fmesh(___,
specifies
surface properties using one or more Name,Value
)Name,Value
pair
arguments. Use this option with any of the input argument combinations
in the previous syntaxes.
fmesh(
plots
into the axes with the object ax
,___)ax
instead of the
current axes object gca
.
returns
a function surface object or a parameterized function surface object.
Use the object to query and modify properties of a specific mesh.obj
= fmesh(___)
fsurf
PageNote
For additional examples, follow the fsurf
page
because fmesh
and fsurf
share
the same syntax. All examples on the fsurf
page
apply to fmesh
.
Plot a mesh of the input over the default range and .
syms x y fmesh(sin(x)+cos(y))
Plot a 3-D mesh of the real part of over the default range and .
syms f(x,y)
f(x,y) = real(atan(x + i*y));
fmesh(f)
Plot over and by specifying the plotting interval as the second argument of fmesh
.
syms x y f = sin(x) + cos(y); fmesh(f, [-pi pi -5 5])
Plot the parameterized mesh
for and . Make the aspect ratio of the axes equal using axis equal
. See the entire mesh by making the mesh partially transparent using alpha
.
syms s t r = 8 + sin(7*s + 5*t); x = r*cos(s)*sin(t); y = r*sin(s)*sin(t); z = r*cos(t); fmesh(x, y, z, [0 2*pi 0 pi], 'Linewidth', 2) axis equal
alpha(0.8)
fsurf
PageNote
For additional examples, follow the fsurf
page
because fmesh
and fsurf
share
the same syntax. All examples on the fsurf
page
apply to fmesh
.
fmesh
assigns the symbolic variables
in f
to the x
axis, then the y
axis,
and symvar
determines the order of the variables to be assigned. Therefore, variable
and axis names might not correspond. To force fmesh
to assign
x or y to its corresponding axis, create the symbolic
function to plot, then pass the symbolic function to fmesh
.
For example, the following code plots the mesh of f(x,y) = sin(y) in two ways. The first way forces the waves to oscillate with respect to the y axis. The second way assigns y to the x axis because it is the first (and only) variable in the symbolic function.
syms x y; f(x,y) = sin(y); figure; subplot(2,1,1) fmesh(f); subplot(2,1,2) fmesh(f(x,y)); % Or fmesh(sin(y));