How do I emulate MATLAB's comet plot?
frames = Table[
ParametricPlot[{Sin[12 u] Cos[u], Sin[12 u] Sin[u]}, {u, 0, t},
PlotRange -> {{-1, 1}, {-1, 1}}], {t, .001, 2 Pi, 2.1 Pi/100}]
and then either
ListAnimate[frames]
or
Export["movie.gif", frames]
depending on what you want. The latter yields
You can also do this:
Manipulate[ParametricPlot[{Sin[12 u] Cos[u], Sin[12 u] Sin[u]}, {u, 0, t},
PlotRange -> {{-1, 1}, {-1, 1}}], {t, .01, 2 Pi}]
You can use Animate
, you'll note that I added some options, remove them to see why :)
Animate[
ParametricPlot[{Sin[12 u] Cos[u], Sin[12 u] Sin[u]}, {u, 0, umax},
PlotRange -> {-1, 1},
PerformanceGoal -> "Quality"],
{umax, 0.1, 2 Pi}]
You can change Animate
to Manipulate
if you wish to slide back and forth manually as well
Unchecked :
Needs["NETLink`"]
m = CreateCOMObject["matlab.application"]
m@Execute["t = 0:.01:2*pi;
x = sin(12*t).*(cos(t));
y = sin(12*t).*(sin(t));
comet(x,y);"]
First seen this here.