| Contents | Index |
plot::Surface creates a parametrized surface in 3D.
Calls:
plot::Surface([x, y, z], u =
..
, v =
..
, <a = amin .. amax>, Options)
plot::Surface(xyz, u =
..
, v =
..
, <a = amin .. amax>, Options)
plot::Surface(A, u =
..
, v =
..
, <a = amin .. amax>, Options)
Parameters:
|
x, y, z: |
the coordinate functions: arithmetical expressions or piecewise objects depending on the surface parameters |
|
xyz: |
the parametrization: a MuPAD procedure that accepts 2 input parameters |
|
A: |
a matrix of category Cat::Matrix with three entries that provide the parametrization x, y, z |
|
u: |
the first surface parameter: an identifier or an indexed identifier. |
|
|
the plot range for the parameter |
|
v: |
the second surface parameter: an identifier or an indexed identifier. |
|
|
the plot range for the parameter |
See Also:
plot, plot::copy, plot::Function3d, plot::Matrixplot, plotfunc3d
Details:
The surface given by a mapping (“parametrization”)
is the set of all image points
![ImageSet(matrix([[x(u, v)], [y(u, v)], [z(u, v)]]), u in [u_min, u_max], v in [v_min, v_max]) in R_^3`.`](PRIMITIV_Surface_images/math42.png)
The expressions/functions x, y, z may have singularities in the plot range. Although a heuristics is used to find a reasonable viewing range when singularities are present, it is highly recommended to specify a viewingbox via the attribute
with suitable numerical real values
. Cf. example 3.
Animations are triggered by specifying a range
for a parameter a that is different from the surface parameters u, v. Cf. example 5.
The functions x, y, z are evaluated on a regular equidistant mesh of sample points in the
-
plane. This mesh is determined by the attributes UMesh, VMesh. By default, the attribute AdaptiveMesh = 0 is set, i.e., no adaptive refinement of the equidistant mesh is used.
If the standard mesh does not suffice to produce a sufficiently detailed plot, one may either increase the value of UMesh, VMesh or USubmesh, VSubmesh, or set AdaptiveMesh = n with some (small) positive integer n. If necessary, up to
additional points are placed in each direction of the
-
plane between adjacent points of the initial equidistant mesh. Cf. example 6.
The “coordinate lines” (“parameter lines”) are curves on the surface.
The phrase “ULines” refers to the curves
with the parameter
running from
to
, while
is some fixed value from the interval
.
The phrase “VLines” refers to the curves
with the parameter
running from
to
, while
is some fixed value from the interval
.
By default, the parameter curves are visible. They may be “switched off” by specifying ULinesVisible = FALSE and VLinesVisible = FALSE, respectively.
The coordinate lines controlled by ULinesVisible = TRUE/FALSE and VLinesVisible = TRUE/FALSE indicate the equidistant mesh in the
-
plane set via the UMesh, VMesh attributes. If the mesh is refined by the USubmesh, VSubmesh attributes, or by the adaptive mechanism controlled by AdaptiveMesh = n, no additional parameter lines are drawn.
As far as the numerical approximation of the surface is concerned, the settings
,
,
,
and
,
, USubmesh = 0, VSubmesh = 0 are equivalent. However, in the first setting, nu parameter lines are visible in the
direction, while in the latter setting
parameter lines are visible. Cf. example 7.
Use Filled = FALSE to render the surface as a wireframe.
Example 1
Using standard spherical coordinates, a parametrization of a sphere of radius
by the azimuth angle
and the polar angle
is given by:
x := r*cos(u)*sin(v):
y := r*sin(u)*sin(v):
z := r*cos(v):
We fix
and create the surface object:
r := 1:
s := plot::Surface([x, y, z], u = 0 .. 2*PI, v = 0 .. PI)
![]()
We call plot to plot the surface:
plot(s, Scaling = Constrained):

delete x, y, z, r, s:
Example 2
The parametrization can also be specified by piecewise objects or procedures:
x := u*cos(v):
y := piecewise([u <= 1, u*sin(v)], [u >= 1, u^2*sin(v)]):
z := proc(u, v)
begin
if u <= 1 then
0
else
cos(4*v)
end_if:
end_proc:
plot(plot::Surface([x, y, z], u = 0 .. sqrt(2), v = 0 .. 2*PI)):

We enable adaptive sampling to get a smoother graphical result:
plot(plot::Surface([x, y, z], u = 0 .. sqrt(2), v = 0 .. 2*PI),
AdaptiveMesh = 3):

delete x, y, z, s, r:
Example 3
We plot a surface with singularities:
s := plot::Surface([u*cos(v), u*sin(v), 1/u^2],
u = 0 .. 1, v = 0 .. 2*PI):
plot(s):

We specify an explicit viewing range for the
coordinate:
plot(s, ViewingBox = [Automatic, Automatic, 0 .. 10]):

delete s:
Example 4
By introducing non-real function evaluations, we can plot surfaces with holes:
chi := piecewise([sin(4*u) < cos(3*v)+0.5, 1]):
plot(plot::Surface([cos(u)*sin(v),
sin(u)*sin(v),
chi*cos(v)],
u = 0 .. 2*PI, v = 0 .. PI,
AdaptiveMesh=2), Scaling = Constrained)

Example 5
We generate an animation of a surface of revolution. The graph of the function
is rotated around the
-axis:
f := u -> 1/(1 + u^2):
plot(plot::Surface([u, f(u)*sin(v), f(u)*cos(v)], u = -2 .. 2,
v = 0 .. a*2*PI, a = 0 .. 1)):


See plot::XRotate, plot::ZRotate for an alternative way to create surfaces of revolution.
delete f:
Example 6
The standard mesh for the numerical evaluation of a surface does not suffice to generate a satisfying plot in the following case:
r := 2 + sin(7*u + 5*v):
x := r*cos(u)*sin(v):
y := r*sin(u)*sin(v):
z:= r*cos(v):
plot(plot::Surface([x, y, z], u = 0 .. 2*PI, v = 0 .. PI)):

We increase the number of mesh points. Here, we use USubmesh, VSubmesh to place 2 additional points in each direction between each pair of neighboring points of the default mesh. This increases the runtime for computing the plot by a factor of
:
plot(plot::Surface([x, y, z], u = 0 .. 2*PI, v = 0 .. PI,
USubmesh = 2, VSubmesh = 2)):

Alternatively, we enable adaptive sampling by setting the value of AdaptiveMesh to some positive value:
plot(plot::Surface([x, y, z], u = 0 .. 2*PI, v = 0 .. PI,
AdaptiveMesh = 2)):

delete r, x, y, z:
Example 7
By default, the parameter lines of a parametrized surface are “switched on”:
x := r*cos(phi):
y := r*sin(phi):
z := r^2:
plot(plot::Surface([x, y, z], r = 1/3 .. 1, phi = 0 .. 2*PI)):

The parameter lines are “switched off”:
plot(plot::Surface([x, y, z], r = 1/3 .. 1, phi = 0 .. 2*PI,
ULinesVisible = FALSE,
VLinesVisible = FALSE)):

The number of parameter lines are determined by the attributes UMesh and VMesh:
plot(plot::Surface([x, y, z], r = 1/3 .. 1, phi = 0 .. 2*PI,
UMesh = 5, VMesh = 12)):

When the mesh is refined via the attributes USubmesh, VSubmesh, the numerical approximation of the surface becomes smoother. However, the number of parameter lines is determined by the values of UMesh, VMesh and is not increased:
plot(plot::Surface([x, y, z], r = 1/3 .. 1, phi = 0 .. 2*PI,
UMesh = 5, VMesh = 12,
USubmesh = 1, VSubmesh = 2)):

Example 8
Klein's bottle is a surface without orientation. There is no “inside” and no “outside” of the following object:
bx := u -> -6*cos(u)*(1 + sin(u)):
by := u -> -14*sin(u):
r := u -> 4 - 2*cos(u):
x := (u, v) -> piecewise([u <= PI, bx(u) - r(u)*cos(u)*cos(v)],
[PI < u, bx(u) + r(u)*cos(v)]):
y := (u, v) -> r(u)*sin(v):
z := (u, v) -> piecewise([u <= PI, by(u) - r(u)*sin(u)*cos(v)],
[PI < u, by(u)]):
KleinBottle:= plot::Surface(
[x, y, z], u = 0 .. 2*PI, v = 0 .. 2*PI,
Mesh = [35, 31], LineColor = RGB::Black.[0.2],
FillColorFunction = RGB::MuPADGold):
plot(KleinBottle, Axes = None, Scaling = Constrained,
Width = 60*unit::mm, Height = 72*unit::mm,
BackgroundStyle = Pyramid):

delete bx, by, r, x, y, z, KleinBottle:
Example 9
Finally we create an animated surface plot of
where
is the animation parameter:
plot(
plot::Surface(
[sin(u),sin(v),a*sin(u+v)],
u=0..2*PI, v=0..2*PI, a=1..0,
AnimationStyle = BackAndForth
)
)



Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |