Animate function

m1 = 3.5;
m2 = 1.7;
m3 = 0.3;
x1[t_] = Sin[3 t];
y1[t_] = 2 t^2 - 1;
x2[t_] = 4 Log[3 t + 2];
y2[t_] = Sin[2 t];
x3[t_] = Tan[5/(t + 1)];
y3[t_] = Exp[-2 t];
T = 2;
M = m1 + m2 + m3;
xC[t_] = (m1 x1[t] + m2 x2[t] + m3 x3[t])/M;
yC[t_] = (m1 y1[t] + m2 y2[t] + m3 y3[t])/M;
Animate[ParametricPlot[{xC[t], yC[t]}, {t, 0, 2}], {?? ??}]

How to make the "animate" change the value of t?

• What exactly to you mean by change the value of t? t is already fixed by ParametricPlot, so it's not a variable in the animated expression any more. Do you want to vary the range of t? What exactly should be animated? Mar 1, 2015 at 11:01
• I need to show the process of drawing this graph with the change t.
– Mike
Mar 1, 2015 at 11:06
• If you want to change the range of t you could do something like ..., {t, 0, u}], {u, 0, 2}]. You might have to fix PlotRange in ParametricPlot then though so that the frame remains the same throughout the animation. Mar 1, 2015 at 11:09
• Thank you, man!how can I put you plus?
– Mike
Mar 1, 2015 at 11:15

You can animate the function being drawn by varying the range of t, not t itself (since t is already fixed). However, you'll need to fix PlotRange (and probably PlotPoints) for animation to look nice:

Animate[
ParametricPlot[
{xC[t], yC[t]},
{t, 0, u},
PlotRange -> {{-1.5, 3.5}, {-1, 4.5}},
PlotPoints -> 60
],
{u, 0.01, 2}
]


Note that your function has a discontinuity at $t = (10 - 3\pi)/3\pi$ (there are others, but this is the one within $[0,2]$). Mathematica plots the function by sampling it and joining up the samples, so you'll get a line where the discontinuity should be. This can be fixed with Exclusions. Just add another option to ParametricPlot:

  ...,
Exclusions -> (10 - 3 \[Pi])/(3 \[Pi])
]

• And another question. Because of x3 [t_] = Tan [5 / (t + 1)];, graph on top does not look good, is this normal?
– Mike
Mar 1, 2015 at 11:21
• I do not have enough reputation to vote up
– Mike
Mar 1, 2015 at 11:25
• @Mike I addressed the discontinuity. Mar 1, 2015 at 11:31
• You're a great help, thank you very much
– Mike
Mar 1, 2015 at 11:35