Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Name of the animation parameter

`ParameterBegin` , `ParameterEnd` , `ParameterName` | Optional | MuPAD^{®} expression |

`ParameterRange` | [`ParameterBegin` .. `ParameterEnd` ] | Range of arithmetical expressions |

Typically, animations are triggered by passing an equation of
the form `a = `a_{min}`..`a_{max}``

in the definition
of an object.

This is equivalent to passing the attributes ```
ParameterName
= a
```

, `ParameterBegin = a`

,
and _{min}`ParameterEnd = a`

in
the definition of the object._{max}

The attribute `ParamterRange = `a_{min}`..`a_{max}``

is
equivalent to setting both `ParameterBegin = a`

and _{min}```
ParameterEnd
= a
```

._{max}

Animations are defined object by object, not frame by frame.

In most cases, the user will define animations by passing an
equation of the form `a = `a_{min}`..`a_{max}``

in
the definition of an object. Any equation of this form that is not
essential for the definition of a static version of the object is
interpreted as an animation parameter and an animation range.

Passing such an equation is equivalent to setting the three attributes

`ParameterName = a`

, ```
ParameterBegin
= a
```

, _{min}`ParameterEnd = a`

._{max}

The attribute `ParamterRange = `a_{min}`..`a_{max}``

serves
as a short cut for setting both `ParameterBegin = a`

and _{min}```
ParameterEnd
= a
```

._{max}

The values `a`

and _{min}`a`

are
the parameter values at the beginning and the end of the real time
range in which an object is animated. This time range is set by the
attributes _{max}`TimeBegin`

and `TimeEnd`

,
respectively.

The parameter range ``a_{min}`..`a_{max}``

is
mapped linearly to this time interval.

The name of the animation parameter may be an identifier or an indexed identifier. This parameter is a `global variable' that may be present in other quantities or attributes defining the object.

The definition of an object may involve procedures rather than
symbolic expressions. E.g., a 2D function plot may be defined by ```
plot::Function2d(f,
x = x_0..x_1)
```

, where *f* is
a procedure accepting one numerical argument *x* from
the plot range between *x*_{0} und *x1*.

In an animated version ```
plot::Function2d(f, x = x_0..x_1,
a = `a_{min}`..`a_{max}`)
```

, the function *f* will
be called with two arguments *x* and *a*.
Thus, *f* may
be defined as a function accepting two parameters *x*, *a* or
as a function with one parameter *x*,
using the animation parameter *a* as
a global variable.

Each animated object has its own animation parameter and range ``a_{min}`..`a_{max}``

.
It is not necessary that several animated objects in a scene use the
same parameter name. It is not used to synchronize the animations.

The synchronization is determined uniquely by the linear correspondence
between the animation range ``a_{min}`..`a_{max}``

and
the real time span of the animation set by the attributes `TimeBegin`

and `TimeEnd`

of
the object.

The definition of a static 2D function plot involves the specification
of one range (for the *x* variable):

plot(plot::Function2d(sin(x), x = 0 .. 2*PI))

When a "surplus equation" `a = `a_{min}`..`a_{max}``

is
passed, this is interpreted as a call to animate the function. The
animation parameter may turn up in the expression defining the function:

plot(plot::Function2d(sin(x + a), x = a .. 2*PI, a = 0..PI))

A static function plot in 3D requires two ranges (for the *x* and
the *y* variable):

plot(plot::Function3d(sin(x)*sin(y), x = 0 .. PI, y = 0..PI))

Now, a third equation `a = `a_{min}`..`a_{max}``

triggers
an animation:

plot(plot::Function3d(sin(x + a)*sin(y - a), x = 0 .. PI, y = 0..PI, a = 0..PI))

We define an animated 2D function plot:

f := plot::Function2d(x^3 + a*x, x = -1..1, a = 0..2): plot(f):

We swap the role of the independent variable *x* and
the animation parameter *a*:

[f::XName, f::ParameterName] := [f::ParameterName, f::XName]: [f::XRange, f::ParameterRange] := [f::ParameterRange, f::XRange]:

The function now is drawn as a function of *a* for
various values of the "time" *x*:

plot(f)

delete f:

We demonstrate the use of procedures in the definition of animated functions.

We wish to plot the eigenvalues of a matrix that depends on
two parameters *x* and *a*.
The eigenvalues are computed numerically in the procedure `eigenvals`

.
This procedure uses `option remember`

, because it is called
thrice with the same arguments by the procedures `f`

, _{1}`f`

, _{2}`f`

that
produce the smallest, the middle, and the largest eigenvalue, respectively,
as functions of the parameters _{3}*x* and *a*:

eigenvals := proc(x, a) option remember; local A; begin A:= matrix([[1, a, x ], [a, 2, a*x], [x, a*x, 3 ]]): sort(numeric::eigenvalues(A)): end_proc: f1:= (x, a) -> eigenvals(x, a)[1]: f2:= (x, a) -> eigenvals(x, a)[2]: f3:= (x, a) -> eigenvals(x, a)[3]:

plot(plot::Function2d(f1, x = -2..2, a = 0..2, Color = RGB::Red), plot::Function2d(f2, x = -2..2, a = 0..2, Color = RGB::Green), plot::Function2d(f3, x = -2..2, a = 0..2, Color = RGB::Blue)):

delete eigenvals, f1, f2, f3:

`Frames`

|`TimeBegin`

|`TimeEnd`

|`TimeRange`

|`VisibleAfter`

|`VisibleAfterEnd`

|`VisibleBefore`

|`VisibleBeforeBegin`

|`VisibleFromTo`

Was this topic helpful?