comet
Animates a 2-D curve with a moving head and a trailing tail.
Category: Graphics > 2-D and 3-D Plots
Syntax
comet(y)
Animates y against its index.
comet(x, y)
Animates the path (x, y).
comet(x, y, p)
Sets the tail length as a fraction p of the path; the default is 0.1.
Description
The head is drawn point by point along the path, with the recent points left behind as a tail and the whole path kept as a thin line at the end. It is meant for showing the order in which a trajectory is traversed.
Input arguments
x, y- Vectors of the same length with the path coordinates.
p- Tail length as a fraction of the number of points.
Example
A spiral
t = linspace(0, 6*pi, 200);
comet(t.*cos(t), t.*sin(t))
In the app, the figure is drawn below the code.