Solving System of ODE with global condition

1 Ansicht (letzte 30 Tage)
Cone
Cone am 19 Apr. 2021
Kommentiert: Cone am 19 Apr. 2021
I'm currently working on a system of 10 differential equations describing the cell devision cycle.
I'm struggling with the implementation of the mass devision, which happens whenever the first varible crosses zero with a negative slope. This is a globsl condition which happens multiple times during the chose timeframe.
So far I've done it this way:
But the problem is that the devision of the mass dy(10) by 0.5 happens EVERYTIME it's below 0.
I want this division only to be executed when dy(1) crosses zero with a negative slope only.
Kind regard for your help!
function dy=cellcycle(t,y)
dy(1)=..;
dy(2)=...;
..
dy(10)=;
if(dy(1))
dy(10)=0.5*dy(10) %need to take care of the slope as well....
end
end
  2 Kommentare
Cone
Cone am 19 Apr. 2021
Thanks a lot for your immediate answer, Stephan!
This should be the solution.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by