我正在尝试获得动画双摆。尽管我可以获得任何(一个)质量的动画,但是我却不能同时获得两个动画。
restart;
with(DEtools, odeadvisor);
with(plots);
with(plottools);
Sys := [2*(diff(T1(t), t, t))+cos(T1(t)-T2(t))*(diff(T2(t), t, t))+sin(T1(t)-T2(t))*(diff(T2(t), t))^2+19.6*sin(T1(t)) = 0, diff(T2(t), t, t)+cos(T1(t)-T2(t))*(diff(T1(t), t, t))-sin(T1(t)-T2(t))*(diff(T1(t), t))+9.8*sin(T2(t)) = 0, T1(0) = 1, (D(T1))(0) = 0, T2(0) = 1, (D(T2))(0) = 1];
sol := dsolve(Sys, type = numeric, range = 0 .. 20, output = listprocedure);
odeplot(sol, [T1(t), T2(t)], 0 .. 20, refine = 1);
TT1, TT2 := op(subs(sol, [T1(t), T2(t)]));
f := proc (t) options operator, arrow; pointplot([cos(TT1(t)), sin(TT1(t))], color = blue, symbol = solidcircle, symbolsize = 25) end proc;
p := proc (t) options operator, arrow; pointplot([cos(TT2(t)), sin(TT2(t))], color = red, symbol = solidcircle, symbolsize = 25) end proc;
任何帮助将不胜感激。
答案 0 :(得分:1)
您没有提供有关方程式对物理系统建模的方式的解释,这没有帮助。
因此,我对您的意图和模型做出了一些猜测。如果我的猜测没有实现,请不要怪我。
restart;
with(plots):
Sys := [2*(diff(T1(t), t, t))+cos(T1(t)-T2(t))*(diff(T2(t), t, t))
+sin(T1(t)-T2(t))*(diff(T2(t), t))^2+19.6*sin(T1(t)) = 0,
diff(T2(t), t, t)+cos(T1(t)-T2(t))*(diff(T1(t), t, t))
-sin(T1(t)-T2(t))*(diff(T1(t), t))+9.8*sin(T2(t)) = 0,
T1(0) = 1, (D(T1))(0) = 0, T2(0) = 1, (D(T2))(0) = 1]:
sol := dsolve(Sys, numeric, range = 0 .. 20, output = listprocedure):
TT1, TT2 := op(subs(sol, [T1(t), T2(t)])):
fp := t -> plots:-display(
pointplot([sin(TT1(t))+sin(TT2(t)), -cos(TT1(t))-cos(TT2(t))],
color = red, symbol = solidcircle, symbolsize = 25),
pointplot([sin(TT1(t)), -cos(TT1(t))],
color = blue, symbol = solidcircle, symbolsize = 25),
plottools:-line([0,0],[sin(TT1(t)), -cos(TT1(t))]),
plottools:-line([sin(TT1(t)), -cos(TT1(t))],
[sin(TT1(t))+sin(TT2(t)), -cos(TT1(t))-cos(TT2(t))]),
scaling=constrained
):
animate(fp, [t], t=0..10, frames=200);
我不知道这种堆叠视图是否是您所追求的,以表示“两个”群众的立场。真的不清楚你的意思是什么。
但是也许关键是,如果您在pointplot
调用中使用的二元列表表示(位移)矢量,那么您可以通过将它们相加来获得第二个质量的叠加/累积效果两个向量逐元素。这就是红点在动画中的位置。希望这将使您能够在自己选择的表示形式中获得两种质量的累积效果。