# Exporting as GIF [duplicate]

I want to export a simple animation as GIF. I had a look at here but could not understand what was being described. Any help would be appreciated.

For instance, how do I export the following animation as an GIF.

u[x_, t_] = -(1/2) Cos[x - t]^2 + 1;

Animate[Plot[u[x, t],{x, -10, 10},PlotRange->{0, 1.5},PlotStyle->{Red, Thickness[0.005]}],{t, 0, 10, 0.02}]


## marked as duplicate by Mark McClure, ybeltukov, RunnyKine, bobthechemist, Michael E2Aug 28 '14 at 17:40

Simply replace Animate with Table and store the result in a variable. I also edited your time range and suppressed the result with a semi-colon.

u[x_, t_] = -(1/2) Cos[x - t]^2 + 1;
pics = Table[Plot[u[x, t], {x, -10, 10}, PlotRange -> {0, 1.5},
PlotStyle -> {Red, Thickness[0.005]}], {t, 0, 2 Pi, 2 Pi/50}];


Now, Export:

Export["anim.gif", pics]


• Dear Mark McClure, Thanks. I figured that out just a few minutes ago and was going to add it as a comment when I saw your answer:-). Thank you for your help. – Radz Aug 28 '14 at 15:05
• No problem - I'm glad you figured it out. – Mark McClure Aug 28 '14 at 15:06