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

浪子不回头ぞ 提交于 2020-01-01 11:57:10

问题


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.


回答1:


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}]



来源:https://stackoverflow.com/questions/13922799/animate-the-movement-of-a-point-along-the-plot-of-a-specific-solution-obtained-u

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!