solving nonlinear ode for a set period

3 次查看(过去 30 天)
hi all,
I am solving a set of ODE (non-linear) here is first (this one is linear but i need to solve this concept before moving on).
f2 = @(t,X) [a*X(1)];
a is a number.
[t,y] = ode45(f2,[0 : t],[1]);
how can i set up the code so that the it stops at time t when a certain value in y has been reached. Then a new ODE comes into play.
thanks everyone - much appreciated.

采纳的回答

Star Strider
Star Strider 2021-2-8
See the documentation section on ODE Event Location.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Ordinary Differential Equations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by