Number of frames in an animation
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.
Frames determines the number of frames in
the animation of an object.
n with a positive
n sets the number of frames for the animation
of an object to
The resulting frame rate is
(frames per second).
Increasing the number of frames does not mean that the animation lasts longer, because the renderer does not work with a fixed number of frames per second.
Note that the human eye cannot distinguish between different
frames if they change with a rate of more than 25 frames per second.
Thus, the number of frames n for
an animation should satisfy
n < 25 (t1 -
With the default time range
it does not make sense to specify
> 250. If a higher n is
required to obtain a sufficient resolution of the animated object,
one should increase the time for the animation by a sufficiently high
We set the number of frames for the following animation to 40. The default animation range of 10 seconds is used. This results in a frame rate of 4 frames per second:
plot(plot::Function2d(sin(a*x), x = -PI..PI, a = 1..2, Frames = 40)):
Here is an example of different frame rates in one plot. The default animation range of 10 seconds is used.
The red point is sampled with 30 frames in 10 seconds, the blue one with 100 frames in 10 seconds. The animation of the blue point is much smoother:
plot(plot::Function2d(sin(x), x = 0..PI, Color = RGB::Black), plot::Point2d([a , sin(a) + 0.07], a = 0 .. PI, Color = RGB::Red, Frames = 30), plot::Point2d([a , sin(a) - 0.07], a = 0 .. PI, Color = RGB::Blue, Frames = 100), PointSize = 4*unit::mm):