This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Contour surfaces of a function from R^3 to R

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.


plot::Implicit3d(f, x = xmin .. xmax, y = ymin .. ymax, z = zmin .. zmax, <a = amin .. amax>, options)


plot::Implicit3d(f(x, y, z), x = xmin..xmax , y = ymin..ymax , z = zmin..zmax ) plots the surfaces where the smooth function f is zero.

plot::Implicit3d(f, x = xmin..xmax , y = ymin..ymax , z = zmin..zmax ) plots the (two-dimensional part of the) zeroes of f in the given range, i.e., the set .

plot::Implicit3d assumes that f is regular almost everywhere on this surface, which means that f must be differentiable and at least two of its partial derivatives must be nonzero.

plot::Implicit3d evaluates the given function on an equidistant, three-dimensional mesh, the coarsity of which can be set with the attributes XMesh, YMesh, and ZMesh for each of the three directions, or with the combining attribute Mesh that sets all three of these simultaneously.

After finding an initial triangulation of the surface from the numerical data on the initial grid, plot::Implicit3d optionally performs adaptive subdivision of the triangles. To make a long story short: If the initial calculation misses details altogether, adaptive refinement will not find them either. On the other hand, if the initial calculation shows spurious spikes, adaptive refinement will result in a much more realistic image, at the expense of time; the higher the value of AdaptiveMesh, the more. Increasing AdaptiveMesh by one may in extreme cases increase calculation time by a factor of eight or more!

The details of the algorithm are as follows: On top level, the "effective adaptive level" is set to the value of the attribute AdaptiveMesh. If, for a given edge, the effective adaptive level is positive and the edge is not very short already, compared with the size of the complete image, and inserting a new point on the implicit surface near the middle of this edge would cause the two new edges to have an angle of less than 170 degrees, then the edge is split, the adjoining triangles are split accordingly (taking into account all their edges) and all the new edges caused by this operation are examined with an effective adaptive level reduced by one.

To plot other contours than zeroes, use the option Contours.


AttributePurposeDefault Value
AdaptiveMeshadaptive sampling0
AffectViewingBoxinfluence of objects on the ViewingBox of a sceneTRUE
Colorthe main colorRGB::Red
Contoursthe contours of an implicit function[0]
Filledfilled or transparent areas and surfacesTRUE
FillColorcolor of areas and surfacesRGB::Red
FillColor2second color of areas and surfaces for color blendsRGB::CornflowerBlue
FillColorTypesurface filling typesDichromatic
FillColorFunctionfunctional area/surface coloring 
FillColorDirectionthe direction of color transitions on surfaces[0, 0, 1]
FillColorDirectionXx-component of the direction of color transitions on surfaces0
FillColorDirectionYy-component of the direction of color transitions on surfaces0
FillColorDirectionZz-component of the direction of color transitions on surfaces1
Framesthe number of frames in an animation50
Functionfunction expression or procedure 
Legendmakes a legend entry 
LegendTextshort explanatory text for legend 
LegendEntryadd this object to the legend?TRUE
LineColorcolor of linesRGB::Black.[0.15]
LineWidthwidth of lines0.35
LineColor2color of linesRGB::DeepPink
LineStylesolid, dashed or dotted lines?Solid
LineColorTypeline coloring typesFlat
LineColorFunctionfunctional line coloring 
LineColorDirectionthe direction of color transitions on lines[0, 0, 1]
LineColorDirectionXx-component of the direction of color transitions on lines0
LineColorDirectionYy-component of the direction of color transitions on lines0
LineColorDirectionZz-component of the direction of color transitions on lines1
Meshnumber of sample points[11, 11, 11]
MeshVisiblevisibility of irregular mesh lines in 3DFALSE
Namethe name of a plot object (for browser and legend) 
ParameterEndend value of the animation parameter 
ParameterNamename of the animation parameter 
ParameterBegininitial value of the animation parameter 
ParameterRangerange of the animation parameter 
PointStylethe presentation style of pointsFilledCircles
PointsVisiblevisibility of mesh pointsFALSE
Shadingsmooth color blend of surfacesSmooth
TimeEndend time of the animation10.0
TimeBeginstart time of the animation0.0
TimeRangethe real time span of an animation0.0 .. 10.0
Titleobject title 
TitleFontfont of object titles[" sans-serif ", 11]
TitlePositionposition of object titles 
TitleAlignmenthorizontal alignment of titles w.r.t. their coordinatesCenter
TitlePositionXposition of object titles, x component 
TitlePositionYposition of object titles, y component 
TitlePositionZposition of object titles, z component 
VisibleAfterobject visible after this time value 
VisibleBeforeobject visible until this time value 
VisibleFromToobject visible during this time range 
VisibleAfterEndobject visible after its animation time ended?TRUE
VisibleBeforeBeginobject visible before its animation time starts?TRUE
XContourscontour lines at constant x values[Automatic, 15]
XMaxfinal value of parameter "x" 
XMeshnumber of sample points for parameter "x"11
XMininitial value of parameter "x" 
XNamename of parameter "x" 
XRangerange of parameter "x" 
YContourscontour lines at constant y values[Automatic, 15]
YMaxfinal value of parameter "y" 
YMeshnumber of sample points for parameter "y"11
YMininitial value of parameter "y" 
YNamename of parameter "y" 
YRangerange of parameter "y" 
ZContourscontour lines at constant z values[Automatic, 15]
ZMaxfinal value of parameter "z" 
ZMeshnumber of sample points for parameter "z"11
ZMininitial value of parameter "z" 
ZNamename of parameter "z" 
ZRangerange of parameter "z" 


Example 1

The set of x, y, z where x2 + y2 + z2 = 1 form a sphere:

plot(plot::Implicit3d(x^2 + y^2 + z^2 - 1,
                      x = -1.5..1.5,
                      y = -1.5..1.5, 
                      z = -1.5..1.5),
     Scaling = Constrained)

Example 2

The set of zeroes of a product is the union of the zeroes of the individual functions:

plot(plot::Implicit3d((x^2 + y^2 + z^2 - 1) * x,
                      x = -1.5..1.5,
                      y = -1.5..1.5, 
                      z = -1.5..1.5),
     Scaling = Constrained)

Note that this image is largely dominated by artifacts caused by the coarse evaluation mesh. Increasing this mesh improves the graphics, but increases computation time:

plot(plot::Implicit3d((x^2 + y^2 + z^2 - 1) * x,
                      x = -1.5..1.5,
                      y = -1.5..1.5, 
                      z = -1.5..1.5,
                      Mesh = [21, 9, 9], AdaptiveMesh = 2),
     Scaling = Constrained)

Example 3

With MeshVisible = TRUE, the internal triangulation becomes visible:

plot(plot::Implicit3d(z^2 - sin(z - x^2*y^2) = 0,
                      x = -1 .. 1, y = -1 .. 1, z = 0 .. 1,
                      AdaptiveMesh = 2, MeshVisible = TRUE,
                      LineColor = RGB::Black.[0.25])):

Example 4

Using functions that are not continuously differentiable, it is possible to generate sharp edges in the images:

plot(plot::Implicit3d(min(x^2 + y^2 + z^2 - 2, -z),
                      x = -2..2, y = -2..2, z = -1.5..0.5),
     Axes = None, Scaling = Constrained)

Just like in the preceding example, these sharp corners are prime sources of artifacts, which may require a finer initial mesh and/or adaptive mesh refinement:

im := plot::Implicit3d(min(x^2 + y, y^2 - z),
                       x = -2..2, y = -2..2, z = 0..1):

plot(im, AdaptiveMesh = 3)

Example 5

Animating plot::Implicit3d objects takes a lot of time. It is easy and fast, though, to add an animated camera object:

plot(plot::Implicit3d(sin(x)+sin(y)+sin(z), x=-5..5, y=-5..5, z=-5..5),
     plot::Camera([42*sin(t),42*cos(t),42*cos(t-sin(t))], [0,0,0],
                  PI/12, t=0..2*PI),



A real-valued expression or an equation in x, y, z, and possibly the animation parameter.

f is equivalent to the attribute Function.

x, y, z


x, y, z are equivalent to the attributes XName, YName, ZName.

xmin .. xmax, ymin .. ymax, zmin .. zmax

Real-valued expressions, possibly in the animation parameter. The image is plotted with x in the range xmin ≤ x ≤ xmax, ymin ≤ y ≤ ymax and zmin ≤ z ≤ zmax.

xmin .. xmax, ymin .. ymax, zmin .. zmax are equivalent to the attributes XRange, XMin, XMax, YRange, YMin, YMax, ZRange, ZMin, ZMax.


Animation parameter, specified as a = amin..amax, where amin is the initial parameter value, and amax is the final parameter value.

See Also

MuPAD Functions

MuPAD Graphical Primitives

Was this topic helpful?