0
$\begingroup$

I'm trying to solve an ODE which independent variable is time, where there is a parameter involved, let's say $\beta$. I need to plot the final solution in terms of $\beta$. The equations, initial conditions and the code I used are \begin{eqnarray} &&\dot{y}=\sin(\beta)\,x^2\\ &&\dot{x}=y\\ &&x(0)=5\\ &&y(0)=\tan(\beta)*x(0) \end{eqnarray}

sol = ParametricNDSolve[{D[y[t], t] == Sin[\[Beta]]*x[t]^2,D[x[t], t] == y[t], x[0] == 5, y[0] == Tan[\[Beta]]*x[0]}, {y,x}, {t, 0, 20}, {\[Beta]}];
 Plot[Evaluate[y[\[Beta]][0.9] /. sol], {\[Beta], 0, 2}]

I used t=0.91

This is the plot of y in terms of $\beta$. Apparently, the solution diverges for some $\beta$ and for each time the graphics changes. How can I stop the integration when x or y grows too much, let's say 2000, save the time that it happens and then plot the final solution in terms of $\beta$ in this certain time?

$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.