Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
Animate[
  Manipulate[
   ParametricPlot[ Evaluate[{x[t], v[t]} /.
    Quiet @ NDSolve[
     {x'[t] == v[t],
     v'[t] == μ (1 - x[t]^2) v[t] - x[t] + A*Cos[ω*t],
     x[0] == xv0[[1]], v[0] == xv0[[2]]}, {x[t], v[t]}, {t, 0, tt}]],
    {t, 0, tt}, ImageSize -> {450, 450}, PlotRange -> 4, 
    AxesLabel -> {TraditionalForm[x[t]], TraditionalForm[v[t]]},
    PlotStyle -> PointSize[.5]
  ],
  {{μ, 0.75, "parameter μ"}, 0, 3, 0.01, Appearance -> "Labeled"},
  {{ω, 0.75, "parameter ω"}, 0, 3, 0.01, Appearance -> "Labeled"},
  {{A, 0.75, "parameter A"}, 0, 3, 0.01, Appearance -> "Labeled"},
  {{xv0, {1, 1}}, {-4, -4}, {4, 4}, Locator}], {tt, 0, 200}, 
  AnimationRate -> 3, AnimationRepetitions -> 3, AnimationRunning -> True
]
share|improve this question
2  
Not to answer your question (which you yourself should be able to work out with the online help of Export etc.), but I moved from GIF to MOV which works nicely as described here: mathematica.stackexchange.com/a/4236/131. The quicktime movies have true color and integrate nicely into Powerpoint. – Yves Klett Jun 18 '13 at 14:32
    
Yves Klett The thing is, is that I have been working on this for awhile but the only thing it produces is a picture. Nothing moves. – Slightly Jun 18 '13 at 14:35
    
Second argument of Export should be list of pictures. It is written in help. – Kuba Jun 18 '13 at 14:46
    
Nothing is working. I don't know what I'm doing wrong! – Slightly Jun 18 '13 at 14:56
    
This seems not a duplicate but there is an answer: mathematica.stackexchange.com/q/4727/5478 – Kuba Jun 18 '13 at 15:46
up vote 14 down vote accepted

You have to set values which are dynamic in Manipulate.

μ = .75; ω = .75; A = .075; xv0 = {1, 1};

Table pictures for different tt:

sol = Quiet@NDSolve[{x'[t] == v[t], v'[t] == μ (1 - x[t]^2) v[t] - x[t] + A*Cos[ω*t], 
                     x[0] == xv0[[1]], v[0] == xv0[[2]]
                    }, {x[t], v[t]}, {t, 0, 20}];

dat = Table[
            ParametricPlot[Evaluate[{x[t], v[t]} /. sol, {t, 0, tt}, 
                           PlotRange -> 4, AxesLabel -> {x[t], v[t]}]
            , {tt, .1, 20, .2}];

Create gif.

SetDirectory@NotebookDirectory[]
Export["gif.gif", dat]

enter image description here

share|improve this answer
    
Can you include a slider by this method too where you can decide the speed of the animation? So other format needed too then. Any possibilities with Mathematica? – Masi Dec 29 '14 at 21:29
1  
@Masi You can add DisplayDurations option: mathematica.stackexchange.com/a/29485/5478 – Kuba Dec 29 '14 at 21:30
    
But I want the user to decide real-time the speed of animation. So I think gif is not a choice. – Masi Dec 29 '14 at 21:34
    
@Masi you can save Manipulate/Animate as CDF. If not then it does not matter if you use gif or other movie extension, you need a player able to specify frames per second. (I hope I get your question) – Kuba Dec 29 '14 at 21:49
    
Do You mean that you can have this kind of speed bar in the animation in Gif too? stackoverflow.com/q/27680783/54964 – Masi Dec 29 '14 at 22:09

You can capture the frames as you manually manipulate like this:

 frames = {}
 Animate[Manipulate[(AppendTo[frames, ParametricPlot[ ... ] ])[[-1]] .. ]  ]

disable dynamic updating when done, then

 Export["test.gif",frames]

enter image description here

warning this will quickly generate a large number of frames..

share|improve this answer

You can adjust the step size by changing the increment in the Table and you can adjust the animation rate using "DisplayDurations", e.g. for the Table above.

Export["dat.gif",dat, "DisplayDurations"->Table[t,{Length[dat]}]] 

where t is display duration in seconds (frame rate: 1/t). Other options for exporting are in the GIF documentation

share|improve this answer

I came across this very helpful video when perusing Wolfram's documentation:

How to Import and Export animations video by WRI

share|improve this answer

I did not take a deep look at your code,but since you are using animate command,I suppose that your code is producing an animation which you can export it as movie into your powerpoint slides.

Export["test.avi",%]

which produces an .avi movie in your document folder.

share|improve this answer
    frame[a_]:=Plot[a x^2,{x,-1,1}];

    frames=Table[ frame[a],{a,1,3,2/10}];

    Export["location\filename.png",frames];

Make a table of gifs.

Then save then into one gif.

https://www.youtube.com/watch?v=CMor1VtBZzA

Watch this helpful video

share|improve this answer
1  
Please describe the contents of the video and the approach described therein; otherwise I'm afraid that your answer won't be as useful when the link finally breaks at some point in the future. – MarcoB May 30 at 5:56
1  
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review – Karsten 7. May 30 at 6:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.