Parameter Sweeps
Model a bouncing ball dropped from 20 different heights.
pfun = ParametricNDSolveValue[{y''[t] == -9.8bounce[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];Plot[Evaluate[Table[pfun[height][t], {height, 1, 5, .2}]], {t, 0, 4}, PlotRange -> All, ImageSize -> Medium]pfunt = ParametricNDSolveValue[{y''[t] == -9.8bounce[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];h = s /. FindRoot[pfunt[s] == 0, {s, 3}]Show[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]