1
$\begingroup$

I want to add time in the ListAnimate so that after I exporting the video I can see the graph changes by time. For example I have a graph that is changes by time, so I want to show in the animation at the time is this the graph is like this, and the graph would be slowly changes by time. How do you do that?

Edit : This is my working code:

eqn = D[u[x, t], {t, 2}] == D[u[x, t], {x, 2}];
a = Derivative[0, 1][u][x, t] /. t -> 0;
ic = {u[x, 0] == Cos[\[Pi]*x] + 2 Cos[3 \[Pi]*x], a == Cos[\[Pi]*x]};
solu3 = NDSolveValue[{eqn, ic}, u, {t, 0, 2}, {x, 0, 1}, 
  Method -> {"MethodOfLines", "TemporalVariable" -> t, 
    "SpatialDiscretization" -> "FiniteElement"}]
list22 = Table[
   Plot3D[solu3[x, t], {x, 0, 1}, {u, -4, 4}, 
    AxesLabel -> {"x", "t", "u"}, PerformanceGoal -> "Speed", 
    MeshFunctions -> {#2 &}, MaxRecursion -> 5], {t, 0, 2, 0.01}];
ListAnimate[list22, 40]
$\endgroup$
1
  • 1
    $\begingroup$ Can you provide data to work on and the code you have so far that produces your ListAnimate? $\endgroup$
    – MarcoB
    May 31 at 13:20

1 Answer 1

2
$\begingroup$

You did not give an example, but you could always add the time to the ListPlot title?

enter image description here

Code

data = Table[Plot[Sin[t x], {x,0,10}, PlotLabel -> Row[{"Time ", t}]], {t,0,20,.5}];
ListAnimate[data, AnimationRate -> 1]
$\endgroup$

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.