Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animate the movement of a point along the plot of a specific solution obtained using ParametricPlot3D

We have the system:

x'[t] == x[t] - 5 y[t] + z[t]
y'[t] == 3 x[t] - 3 y[t] - 3 z[t]
z'[t] == -2 x[t] + 10 y[t] + 4 z[t]

and the initial conditions:

x[0] == .01
y[0] == 3
z[0] == 0

I produced the specific plot:

eqn = {x'[t] == x[t] - 5 y[t] + z[t],  y'[t] == 3 x[t] - 3 y[t] - 3 z[t], 
z'[t] == -2 x[t] + 10 y[t] + 4 z[t]}; 

sol = NDSolve[{eqn, x[0] == .01, y[0] == 3, z[0] == 0}, {x[t], y[t], 
z[t]}, {t, -5, 5}]

{xde[t_], yde[t_], zde[t_]} = {x[t], y[t], z[t]} /. Flatten[sol]

 ParametricPlot3D[{xde[t], yde[t], zde[t]}, {t, 0, 10}, 
 AxesLabel -> {"x", "y", "z"}, 
 PlotRange -> {{-15, 15}, {-15, 15}, {-15, 15}}]

I know how when pick a random point to plot the whole trajectory, but I can't find a way to animate a point moving along the trajectory that was plotted. In this particular example the point should be at t == 0 and move along until t == 2.

like image 557
Sektor Avatar asked Dec 17 '12 21:12

Sektor


1 Answers

This quite easy in Mathematica - use an interactive interface:

Animate[Show[ParametricPlot3D[{xde[t], yde[t], zde[t]}, {t, 0, 10}, 
   AxesLabel -> {"x", "y", "z"}, 
   PlotRange -> {{-5, 15}, {-5, 5}, {-5, 15}}],
  Graphics3D[{Red, PointSize[.05], Point[{xde[T], yde[T], zde[T]}]}]], {T, 0, 2}]

enter image description here

like image 68
Vitaliy Kaurov Avatar answered Sep 27 '22 22:09

Vitaliy Kaurov