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.


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::Sequence(y, n = n1 .. n2, <a = amin .. amax>, options)
plot::Sequence(x, y, n = n1 .. n2, <a = amin .. amax>, options)


plot::Sequence(y(n), n = n_1 .. n_2 ) creates the points


plot::Sequence(x(n), y(n), n = n_1 .. n_2 ) creates the sequence of points


plot::Sequence creates graphs of sequences, i.e., functions and curves defined over (some subset of) the integers.

plot::Sequence(y(n), n = n_1..n_2 ) is functionally equivalent to the call plot::PointList2d([[n, y(n)] $ n = n_1..n_2 ), and plot::Sequence(x(n), y(n), n = n_1..n_2 ) creates the same image as plot::PointList2d([[x(n), y(n)] $ n = n_1..n_2 ). See Example 2 for some extra functionality.


AttributePurposeDefault Value
AffectViewingBoxinfluence of objects on the ViewingBox of a sceneTRUE
AntiAliasedantialiased lines and points?TRUE
Colorthe main colorRGB::Blue
Framesthe number of frames in an animation50
Legendmakes a legend entry 
LegendTextshort explanatory text for legend 
LegendEntryadd this object to the legend?FALSE
LineColorcolor of linesRGB::Blue
LineWidthwidth of lines0.35
LineColor2color of linesRGB::DeepPink
LineStylesolid, dashed or dotted lines?Solid
LinesVisiblevisibility of linesFALSE
LineColorTypeline coloring typesFlat
LineColorFunctionfunctional line coloring 
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 points2
PointStylethe presentation style of pointsFilledCircles
PointsVisiblevisibility of mesh pointsTRUE
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" 
UMininitial value of parameter "u" 
UNamename of parameter "u" 
URangerange of parameter "u" 
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

When given one expression and a range, plot::Sequence plots the sequence in function style:

plot(plot::Sequence((-1)^n/n, n=1..10))

plot::Sequence accepts a variety of attributes to influence the appearance of the plot:

plot(plot::Sequence((-1)^n/n, n=1..10, 
                    PointStyle = FilledDiamonds,
                    PointSize = 4*unit::mm,
                    Color = RGB::Red),
     plot::Sequence(1/n, n=1..10,
                    PointsVisible = FALSE,
                    LinesVisible = TRUE),
     plot::Sequence(-1/n, n=1..10,
                    PointsVisible = FALSE,
                    LinesVisible = TRUE))

Example 2

By giving two expressions, we can make plot::Sequence plot a sequence of points given by two expressions, for the x- and y-coordinate:

plot(plot::Sequence(sin(2*PI*n/60), cos(2*PI*n/60),
                    n = 1..60), Scaling=Constrained)

In contrast to the plot::PointList2d call listed above as equivalent, plot::Sequence allows to easily animate the number of points:

plot(plot::Sequence(sin(2*PI*n/60), cos(2*PI*n/60),
                    n = 1..nmax, nmax = 1..60),
     Scaling=Constrained, Frames = 60, TimeRange = 1..60)

Example 3

By including the animation parameter in the expressions x and y, more complex animations are possible. As an example, we animate Newton iteration for different starting values. First of all, we define the iteration step which maps an approximation to its refinement:

newton := x -> x - f(x)/f'(x):

For concrete calculations, we will need to use a specific function f:

f := x -> sin(2*x) + x^2:

To get successive iteration steps, we will employ the function iteration operator @@. For example, the third improvement of the starting value 1.0 is calculated as follows:


For our animation, we want to show the approximations, the corresponding function values, and the order in which the approximations are found. Additionally, we display the function itself:

function := plot::Function2d(f, x = -2..2):
steps := plot::Sequence((newton@@n)(x0), f((newton@@n)(x0)),
                        n = 0..5, x0 = -1.25..1.5,
                        Color = RGB::Green,
                        LinesVisible = TRUE):
plot(function, steps,
     ViewingBox = [-2..2, -1..5], PointSize = 2.5)

To further increase the number of iteration steps, we should reuse previously computed approximations. To this end, we use a function with option remember:

newtonIter := proc(x0, n)
                option remember;
                if domtype(n) <> DOM_INT then
                if iszero(n) then x0
                else newton(newtonIter(x0, n-1));

Additionally, we use plot::Point2d to display the initial point in a different color.

steps := plot::Sequence(newtonIter(x0, n), f(newtonIter(x0, n)),
                        n = 0..10, x0 = -1.25..1.5,
                        Color = RGB::Green,
                        LinesVisible = TRUE):
start := plot::Point2d(x0, f(x0), x0 = -1.25..1.5):
plot(function, steps, start,
     ViewingBox = [-2..2, -1..5], PointSize = 2.5)

Since f was evaluated in our object definitions, we will need to reissue the corresponding commands when changing f.


x, y

Real-valued arithmetical expressions in n and possibly the animation parameter a.

x, y are equivalent to the attributes XFunction, YFunction.


The index of the sequence: an identifier or an indexed identifier.

n is equivalent to the attribute UName.

n1 .. n2

The range of the index n: real-valued expressions, possibly of the animation parameter a.

n1 .. n2 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

Was this topic helpful?