Parameterized 3D curves

MuPAD® notebooks will be removed in a future release. 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::Curve3d([x, y, z], t = tmin .. tmax, <a = amin .. amax>, options)
plot::Curve3d(A3d, t = tmin .. tmax, <a = amin .. amax>, options)
plot::Curve3d(piecewiseF(t), t = tmin .. tmax, <a = amin .. amax>, options)


plot::Curve3d([x(t), y(t), z(t)], t = tmin.. tmax) creates the space curve


plot::Curve3d constructs curves in one parameter

You can use it to plot animated curves. See Example 1.

The curves can contain poles, in which case automatic clipping is used by default. See Example 2.

By default, curves are sampled at equidistant values of the parameter t. To change this behavior so that a denser sampling rate is used in areas of higher curvature, use the attribute AdaptiveMesh.

Curves are graphical objects that can be manipulated. See the examples and the documentation for the attributes for details.


AttributePurposeDefault Value
AdaptiveMeshadaptive sampling0
AffectViewingBoxinfluence of objects on the ViewingBox of a sceneTRUE
Colorthe main colorRGB::Blue
DiscontinuitySearchsemi-symbolic search for discontinuitiesTRUE
Framesthe number of frames in an animation50
Legendmakes a legend entry 
LegendTextshort explanatory text for legend 
LegendEntryadd this object to the legend?TRUE
LineColorcolor of linesRGB::Blue
LineWidthwidth of lines0.35
LineColor2color of linesRGB::DeepPink
LineStylesolid, dashed or dotted lines?Solid
LinesVisiblevisibility of linesTRUE
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 points121
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 
PointSizethe size of points1.5
PointStylethe presentation style of pointsFilledCircles
PointsVisiblevisibility of mesh pointsFALSE
Submeshdensity of submesh (additional sample points)0
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 
UMaxfinal value of parameter “u”5
UMeshnumber of sample points for parameter “u”121
UMininitial value of parameter “u”-5
UNamename of parameter “u” 
URangerange of parameter “u”-5 .. 5
USubmeshdensity of additional sample points for parameter “u”0
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
XFunctionfunction for x values 
YFunctionfunction for y values 
ZFunctionfunction for z values 


Example 1

A useful and easy type of animation is achieved by animating the parameter range. This creates the illusion of the curve being drawn in real time:

curve := plot::Curve3d([sin(thet)*cos(20*thet),
                       thet = 0..a,
                       a = 0..PI):

Example 2

Curves with poles are automatically clipped:

curve := plot::Curve3d([(1 + tan(3*t)^2)*sin(t),
                        (1 + tan(3*t)^2)*cos(t),
                                    t = 0..2*PI):

If the automatically chosen viewing box is not to your liking, you can explicitly set other values:

curve::ViewingBox := [-3..3, -3..3, -3..3]:

Example 3

Create the following piecewise function:

f := piecewise([t < 0, [t, sin(10*t)^2, t^3]],
               [t >= 0, [t, 5*t/exp(t), -t^2]])

Now, plot this function:

plot(plot::Curve3d(f, t = -10..10))


x, y, z

Real-valued expressions in t (and possibly the animation parameter)


A matrix of category Cat::Matrix with three entries that provide the parametrization x, y, z of a 3D curve


A piecewise object


An identifier or an indexed identifier

tmin, tmax

Real-valued expressions (possibly in the animation parameter)


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