0
$\begingroup$

I'm new with Mathematica and I want to make a simple animation to plot the trajectory of a point.

For example, the parameter function is sin(t) and cos(t) and a point starts from (0,1) so that the animation can show the point starts from (0,1) and after time $2\pi$ there will be a unit circle.

I don't know how to make such animation. Any help would be appreciated. Thank you!

$\endgroup$
3
  • $\begingroup$ What have you tried so far? $\endgroup$
    – ktm
    Feb 19, 2019 at 5:48
  • 4
    $\begingroup$ Animate[Graphics[Circle[{0,0},1,{0,t}],PlotRange->{{-1,1},{-1,1}}],{t,0,2Pi}, AnimationRepetitions->1] Look up each of those words in the help system. Try each of the examples. See which examples have anything like what you want to do. See what functions they use. Look up those functions in the help system. Click on "Details and Options" and study each of the options you can use to modify the function. Try making small changes and see what happens when you modify or remove an option. Then try making something different using what you have learned from this. $\endgroup$
    – Bill
    Feb 19, 2019 at 6:45
  • $\begingroup$ You are looking for something like ParametricPlot[{Sin[t], Cos[t]}, {t, 0, 2 \[Pi]}]. $\endgroup$
    – Carl Lange
    Feb 19, 2019 at 8:29

1 Answer 1

4
$\begingroup$

Such code:

t0 = Pi/2;
Manipulate[
 ParametricPlot[{Cos@t, Sin@t}, {t, t0, \[Tau]},
  AxesOrigin -> {0, 0},
  PlotRange -> {-1.1, 1.1},
  Epilog -> {Red, PointSize[0.025], 
    Point@{Cos@\[Tau], Sin@\[Tau]}}], {\[Tau], 1.000001 t0, 
  t0 + 2 \[Pi]}]

enter image description here

Of course, the Manipulate makes a manually driven animation but changing the code to

t0 = Pi/2;
an = Table[
   ParametricPlot[{Cos@t, Sin@t}, {t, t0, \[Tau]},
    AxesOrigin -> {0, 0},
    PlotRange -> {-1.1, 1.1},
    Epilog -> {Red, PointSize[0.025],Point@{Cos@\[Tau], Sin@\[Tau]}}],
    {\[Tau], 1.000001 t0, 
    t0 + 2 \[Pi], \[Pi]/180}];

    Export["filepath/filename.gif", an, "DisplayDurations" -> 0.1]

You will have the gif as an uploaded here.

$\endgroup$
1
  • $\begingroup$ Thank you so much! $\endgroup$
    – Yifei Xiao
    Feb 19, 2019 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.