Skip to Main Content Skip to Search
Product Documentation

ParameterNamename of the animation parameter

ParameterBegininitial value of the animation parameter

ParameterEndend value of the animation parameter

ParameterRangerange of the animation parameter

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_{min}`, and ParameterEnd = `a_{max}` in the definition of the object.

The attribute ParamterRange = `a_{min}`..`a_{max}` is equivalent to setting both ParameterBegin = `a_{min}` and ParameterEnd = `a_{max}`.

→ Examples

Attribute

Type

Value

See Also:

Frames, TimeBegin, TimeEnd, TimeRange, VisibleAfter, VisibleAfterEnd, VisibleBefore, VisibleBeforeBegin, VisibleFromTo

See Also:

See the section Graphics and Animations in this document. In particular, see the section The Number of Frames and the Time Range for details.

Details:

Example 1

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))

MuPAD graphics

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))

MuPAD graphicsimage

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))

MuPAD graphics

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))

MuPAD graphicsimage

Example 2

We define an animated 2D function plot:

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

MuPAD graphicsimage

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)

MuPAD graphicsimage

delete f:

Example 3

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 f1, f2, f3 that produce the smallest, the middle, and the largest eigenvalue, respectively, as functions of the parameters 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)):

MuPAD graphicsimage

delete eigenvals, f1, f2, f3:

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS