Curves in 2D parameterized in polar coordinates

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::Polar([r, ϕ], u = umin .. umax, <a = amin .. amax>, options)


plot::Polar creates parameterized curves in 2D, with parametrization in polar coordinates.

plot::Polar creates curves in one parameter, with parametrization in polar coordinates and possibly animated (see Example 1 and Example 2). The curves may contain poles, in which case automatic clipping is used by default, see Example 4.

Polar coordinates consist of a radius and an angle. The radius of a point is its distance from the origin (0, 0), while the angle is the angle between the positive “x”-axis (the ordinate) and the connection between the point and the origin, measured in radians and counter-clockwise.

By default, curves are sampled at equidistant values of the parameter t. The attribute AdaptiveMesh can be used to change this behavior, such that a denser sampling rate is used in areas of higher curvature. Cf. Example 3.

Curves are graphical objects that can be manipulated, see the examples and the documentation of the parameters listed below for details.


AttributePurposeDefault Value
AdaptiveMeshadaptive sampling0
AffectViewingBoxinfluence of objects on the ViewingBox of a sceneTRUE
AntiAliasedantialiased lines and points?TRUE
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, 1]
LineColorDirectionXx-component of the direction of color transitions on lines0
LineColorDirectionYy-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 
UMaxfinal value of parameter “u” 
UMeshnumber of sample points for parameter “u”121
UMininitial value of parameter “u” 
UNamename of parameter “u” 
URangerange of parameter “u” 
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 


Example 1

The most basic example of a curve in polar coordinates is a circle: Using a constant radius, the angle goes from 0 to 2 π:

plot(plot::Polar([1, u], u = 0..2*PI))

A constant angle, on the other hand, means a straight line through the origin:

plot(plot::Polar([r, 1], r = 0..1))

plot::Polar accepts negative radii:

plot(plot::Polar([r, 1], r = -1..1))

The most simple “interesting” example is probably Archimedes' spiral:

plot(plot::Polar([r, r], r = 0..5*PI))

Example 2

Polar curves can be animated just like almost anything else:

plot(plot::Polar([r, a*r], r = 0..5*PI, a = -1..1))

Example 3

In some cases, the default of 121 evaluations on the curve is not sufficient and causes visible artifacts:

plot(plot::Polar([r, 4*r^2], r = 0..PI))

One remedy for this problem is to increase the number of evaluation points:

plot(plot::Polar([r, 4*r^2], r = 0..PI, Mesh = 400))

This method is, however, wasteful: Near the center, the initial density was perfectly sufficient, while on the outer edge still more points would be desirable. plot::Polar offers adaptive mesh refinement for exactly these situations. In the following example, we switch on adaptive mesh refinement with up to 24 = 16 points introduced between each two consecutive points of the initial mesh:

plot(plot::Polar([r, 4*r^2], r = 0..PI, AdaptiveMesh=4))

Example 4

If the curve (i.e., the radius expression/function) contains poles, plot::Polar will use heuristics to clip the viewing box:

plot(plot::Polar([tan(t)+1, t], t = 0..2*PI))

To select a different area, use the attribute ViewingBox:

plot(plot::Polar([tan(t)+1, t], t = 0..2*PI,
                 ViewingBox = [-2..2, -2..2]))

Example 5

plot::Polar creates objects that can be manipulated interactively and/or programmatically:

p := plot::Polar([tan(t)+1, t], t = 0..PI)

p::UMax := 2*PI:

p::ViewingBox := [-2..2, -2..2]:
p::LineColor  := RGB::Blue:
p::LineWidth  := 1*unit::mm:


r, ϕ

The coordinate functions: arithmetical expressions or piecewise objects depending on the curve parameter u and the animation parameter a. Alternatively, procedures that accept 1 input parameter u or 2 input parameters u, a and return a real numerical value when the input parameters are numerical.

r, ϕ are equivalent to the attributes XFunction, YFunction.


The curve parameter: an identifier or an indexed identifier.

u is equivalent to the attribute UName.

umin .. umax

The plot range for the parameter u: umin, umax must be numerical real values or expressions of the animation parameter a.

umin .. umax is equivalent to the attributes URange, UMin, UMax.


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