Plotting iterated functions
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::Iteration(f
, x_{0}
, <n
>, x = x_{min} .. x_{max}
, <a = a_{min} .. a_{max}
>, options
)
plot::Iteration
(f, x_{0}
,
n, x = `x_{min}` .. `x_{max}`
) is a graphical object
visualizing the iteration x_{i} = f(x_{i 
1}) (i =
1, …, n) of the given
starting point x_{0}.
The iteration is visualized by connecting the points (x_{0}, 0) and (x_{0}, x_{1}) by a vertical line. For any step of the iteration, a horizontal line is drawn from the point (x_{i  1}, x_{i}) (on the graph of f) to the point (x_{i}, x_{i}) on the main diagonal. From there, a vertical line is drawn to the next pair (x_{i}, x_{i + 1}) of the iteration.
The iteration object neither includes the graph of the function y = f(x) nor the main diagonal y = x. You need to plot them separately if you wish the function and/or the diagonal to be in your picture! See the examples.
The iteration is stopped prematurely when the iterated point
leaves the plot range `x_{min}`..`x_{max}`
. Cf. Example 3.
Despite the fact that the number of iterations n
represents
an integer, it can be animated! Cf. Example 4
The default color used for the iteration plot is RGB
::Grey50
.
It can be modified by setting the attribute Color
or LineColor
.
Cf. Example 1.
The default line style is solid. It can be modified by setting
the attribute LineStyle
.
Attribute  Purpose  Default Value 

AffectViewingBox  influence of objects on the ViewingBox of
a scene  TRUE 
AntiAliased  antialiased lines and points?  FALSE 
Color  the main color  RGB::Grey50 
Frames  the number of frames in an animation  50 
Function  function expression or procedure  
Iterations  number of iterations in plot::Iteration  10 
Legend  makes a legend entry  
LegendText  short explanatory text for legend  
LegendEntry  add this object to the legend?  FALSE 
LineColor  color of lines  RGB::Grey50 
LineWidth  width of lines  0.35 
LineStyle  solid, dashed or dotted lines?  Solid 
Name  the name of a plot object (for browser and legend)  
ParameterEnd  end value of the animation parameter  
ParameterName  name of the animation parameter  
ParameterBegin  initial value of the animation parameter  
ParameterRange  range of the animation parameter  
StartingPoint  starting point of the iteration  
TimeEnd  end time of the animation  10.0 
TimeBegin  start time of the animation  0.0 
TimeRange  the real time span of an animation  0.0 .. 10.0 
Title  object title  
TitleFont  font of object titles  [" sansserif " , 11 ] 
TitlePosition  position of object titles  
TitleAlignment  horizontal alignment of titles w.r.t. their coordinates  Center 
TitlePositionX  position of object titles, x component  
TitlePositionY  position of object titles, y component  
Visible  visibility  TRUE 
VisibleAfter  object visible after this time value  
VisibleBefore  object visible until this time value  
VisibleFromTo  object visible during this time range  
VisibleAfterEnd  object visible after its animation time ended?  TRUE 
VisibleBeforeBegin  object visible before its animation time starts?  TRUE 
XMax  final value of parameter "x"  
XMin  initial value of parameter "x"  
XName  name of parameter "x"  
XRange  range of parameter "x" 
We consider the logistic map for the parameter value 3, i.e., the parabola f(x) = 3 x (1  x) for x ∈ [0, 1]. We iterate the starting point x_{0} = 0.5:
f := plot::Function2d(3*x*(1  x), x = 0..1, Color = RGB::Blue): x0 := 0.5:
We plot the iteration (without specifying the number of iterations), the parabola f and the diagonal line g(x) = x:
g := plot::Function2d(x, x = 0..1, Color = RGB::Red): it := plot::Iteration(3*x*(1  x), x0, x = 0..1): plot(f, g, it)
We increase the number of iterations to 50 and
change the color of the lines to RGB::Black
:
it::Iterations := 50: it::Color := RGB::Black: plot(f, g, it)
Finally, we animate the number of steps, allowing to follow the course of the iteration:
it := plot::Iteration(3*x*(1  x), x0, n, x = 0..1, n = 1..50, Color = RGB::Black): plot(f, g, it)
delete f, g, it:
We consider the logistic map f(x) = a x (1  x) for x ∈ [0, 1] and the animation parameter a running from a = 2 to a = 4:
f := plot::Function2d(a*x*(1  x), x = 0..1, a = 2..4, Color = RGB::Black):
We define the iteration of the starting point x_{0} = 0.2 by f and plot it together with the function graph of f(x) and the diagonal line g(x) = x:
g := plot::Function2d(x, x = 0..1, Color = RGB::Black): it1 := plot::Iteration(a*x*(1  x), 0.2, 30, x = 0..1, a = 2..4, Color = RGB::Red): plot(f, g, it1)
We define an additional iteration starting at x_{0} = 0.21 and add it to the plot:
it2 := plot::Iteration(a*x*(1  x), 0.21, 30, x = 0..1, a = 2..4, Color = RGB::Blue): plot(f, g, it1, it2)
For small values of a, the two iterations converge to the same fixed point. When a approaches the value 4, the iterations drift into chaos.
delete f, g, it1, it2:
Consider the iteration of the starting point x_{0} = 0.2 by the logistic map f(x) = x (x  1) with the plot range x ∈ [0, 1]:
f := plot::Function2d(x*(x  1), x = 0..1): it := plot::Iteration(x*(x  1), 0.2, x = 0..1): plot(f, it)
We see that only one step of the iteration is plotted. The reason
is that the point x_{1} = f(x_{0}) is
negative and, hence, not contained in the requested plot range x
= 0..1
. We modifiy the plot range:
f::XRange:= 0.5..1: it::XRange:= 0.5..1: plot(f, it)
delete f, it:
We animate the parameter n that
sets the number of iterations. We set the time range for the animation
to 40 (seconds). Using Frames
, the total number of frames is
chosen such that approximately 10 frames are used to visualize the
step from n to n +
1:
f := plot::Function2d(4*x*(1  x), x = 0..1): g := plot::Function2d(x, x = 0..1): it := plot::Iteration(4*x*(1  x), 0.4, n, x = 0..1, LineStyle = Dashed, n = 0..40, Frames = 411, TimeRange = 0..40): plot(f, g, it)
delete f, g, it:

The iteration function: an arithmetical expression in the independent
variable


The starting point for the iteration:


The number of iterations:


The independent variable: an identifier or an indexed identifier.


The plot range:


Animation parameter, specified as 