Mathematica出口到avi向前,然后向后

时间:2012-10-15 21:35:51

标签: wolfram-mathematica

我正在对八个行星的重力场进行建模,并尝试将生成的ContourPlot导出为.avi文件。问题是.avi向前和向后播放动画,即使我明确告诉Animate动画方向 - >转发。谁知道任何解决方案?这是令人讨厌的代码:

gfield = Animate[
  ContourPlot[
   Sqrt[Fgravplanets[x, y, t][[1]]^2 + Fgravplanets[x, y, t][[2]]^2],
   {x, -1.5 rp["Neptune"], 1.5 rp["Neptune"]}, {y, -1.5 rp["Neptune"],
     1.5 rp["Neptune"]},
   PlotRange -> {0, 10},
   Mesh -> None,
   ImageSize -> Medium,
   AxesLabel -> {"x", "y", "Fgrav"},
   ColorFunction -> Hue,
   PlotPoints -> 20,
   Contours -> 20
   ],
  {t, 0, 365*24*3600*10, 365*24*3600/10},
  AnimationDirection -> Forward,
  AnimationRate -> 365*24*3600/5
  ]
Export["gfield.avi", gfield]

1 个答案:

答案 0 :(得分:1)

只需将Animate替换为Table

gfield = Table[
   ContourPlot[
   Sqrt[Fgravplanets[x, y, t][[1]]^2 + Fgravplanets[x, y, t][[2]]^2],
   {x, -1.5 rp["Neptune"], 1.5 rp["Neptune"]}, {y, -1.5 rp["Neptune"],
    1.5 rp["Neptune"]},
   PlotRange -> {0, 10},
   Mesh -> None,
   ImageSize -> Medium,
   AxesLabel -> {"x", "y", "Fgrav"},
   ColorFunction -> Hue,
   PlotPoints -> 20,
   Contours -> 20
   ],
 {t, 0, 365*24*3600*10, 365*24*3600/10}];

Export["gfield.avi", gfield]

导出到.avi的工作方式符合预期的图形列表。您可能必须在Table迭代器中调整步长以获得所需的帧速率。