# Parameter Sweeps

Model a bouncing ball dropped from 20 different heights.
 In[2]:= XPlot[Evaluate[Table[pfun[height][t], {height, 1, 5, .2}]], {t, 0, 4}, PlotRange -> All, ImageSize -> Medium]
 In[5]:= XShow[Plot[Evaluate@Table[pfun[s][t], {s, 1, 5, .2}], {t, 0, 4}, PlotStyle -> Lighter[Gray, .5], Epilog -> {Dashed, Line[{{2.5, 0}, {2.5, 5}}]}], Plot[pfun[h][t], {t, 0, 4}], ImageSize -> Medium]
 In[1]:= Xpfun = ParametricNDSolveValue[{y''[t] == -9.8 bounce[t], y[0] == height, y'[0] == 0, bounce[0] == 1, WhenEvent[y[t] == 0, If[Abs[y'[t]] > 10^-6, y'[t] -> -0.7 y'[t], {bounce[t], y'[t]} -> {0, 0}]]}, y, {t, 0, 10}, {height}, DiscreteVariables -> bounce];
 Out[2]=

#### Find a height such that the ball will land at time t=2.5.

 In[3]:= Xpfunt = ParametricNDSolveValue[{y''[t] == -9.8 bounce[t], y[0] == height, y'[0] == 0, bounce[0] == 1, WhenEvent[y[t] == 0, If[Abs[y'[t]] > 10^-6, y'[t] -> -0.7 y'[t], {bounce[t], y'[t]} -> {0, 0}]]}, y[2.5], {t, 0, 4}, {height}, DiscreteVariables -> bounce];
 In[4]:= Xh = s /. FindRoot[pfunt[s] == 0, {s, 3}]
 Out[4]=
 Out[5]=