This question is closed. Reopen it to edit or answer.
Including conditions within ode 45
1 view (last 30 days)
I have a system of equations where a,b,c,d,e,k are constant parameters. In this system the behaviour of y(1) and y(2) over time would be it would reach a peak and then decline. What I want is when both y(1) and y(2) are less than 1, I want y(1) and y(2) to be set to zero. That is I don't want a rebound to happen once y(1) and y(2) reach low values. Also, I want the solutions to y(3) to start after certain time (tr) has passed. Up until that time the value of y(3) should remain at the initial level. This is the function that I am solving using ode45 and this is how I have implemented those conditions.
function s= model(t,y)
if y(1)<1 && y(2)<1
Can someone please let me know if I have done this correctly or is there any other method to do it