2
$\begingroup$

I want to export the solution of a equation

eqn = D[u[t, x, y], t, t] == D[u[t, x, y], x, x] + 
D[u[t, x, y], y, y]/2 + (1 - u[t, x, y]^2) (1 + 2 u[t, x, y]);
fun = First[u /. NDSolve[{eqn, u[0, x, y] == Exp[-(x^2 + y^2)], 
u[t, -5, y] == u[t, 5, y], u[t, x, -5] == u[t, x, 5], 
Derivative[1, 0, 0][u][0, x, y] == 0}, 
u, {t, 0, 4}, {x, -5, 5}, {y, -5, 5}]]

Export:

pl = Table[Plot3D[fun[t, x, y], {x, -5, 5}, {y, -5, 5}, PlotRange -> All],
{t, 0, 4, 1}];
Export["example for animation.gif", pl, "DisplayDurations" -> 1, 
"AnimationRepetitions" -> Infinity]

I just want to export a .GIF file to show the motion of the solution with the time step displayed.

$\endgroup$
2
$\begingroup$
pl = Table[
  Plot3D[fun[t, x, y], {x, -5, 5}, {y, -5, 5}, PlotRange -> All, 
   PlotLabel -> Style["Time = " <> ToString[t], Bold]], {t, 0, 4, 1}];
Export["time.gif", pl, "DisplayDurations" -> 1]

enter image description here

$\endgroup$
  • $\begingroup$ Cheers! I open the .GIF using IE browser, but it does not motion. Do I must use the QuickTime Player to open it? For your answer, I guess you used browser to open it... $\endgroup$ – Enter Feb 17 '15 at 3:00
  • $\begingroup$ @lxy I used Chrome as a browser to open. $\endgroup$ – Zviovich Feb 17 '15 at 14:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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