2012-10-15 29 views
1

我正在對八個行星的重力場進行建模並嘗試將生成的ContourPlot導出爲.avi文件。問題在於.avi會向前和向後播放動畫,即使我明確告訴Animate即AnimationDirection-> Forward。任何人都知道解決方案這裏是有問題的代碼片段:Mathematica導出爲avi向前播放,然後向後

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

通過Table只需更換Animate

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迭代器中的步長以實現所需的幀速率。

+0

完美的作品......非常感謝! – user1748343