Group Abstract Group Abstract

Message Boards Message Boards

Mesh and MeshShading in Manipulate ?

GROUPS:
Hi,

I try to play with the bouncing ball example with plotting Mesh and MeshShading given the Sow-ed points. The plotting can be done statically when the Reap returns {sol, points} and then Mesh->points.

But how to return points in Manipulate function ?  thanks !
Manipulate[ Plot[Evaluate[   y[t] /. Flatten[Reap@NDSolve[{y''[t] == -g, y[0] == 1, y'[0] == 0,   
      WhenEvent[y[t] == 0, y'[t] -> -c y'[t]],
      WhenEvent[y[t] == 0, Sow[t]]},
      y, {t, 0, 6}], 1][[1]]],  {t, 0, 6}, PlotRange -> All],
   {{g, 9.81, "gravity constant"}, 5, 15, Appearance -> "Labeled"},
   {{c, 0.9, "energy loss constant"}, 0.9, 2.0, Appearance -> "Labeled"}]
POSTED BY: Youwei Zheng
Answer
9 months ago