Solving System of ODE with global condition

1 visualización (últimos 30 días)
Cone
Cone el 19 de Abr. de 2021
Comentada: Cone el 19 de Abr. de 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 comentarios
Cone
Cone el 19 de Abr. de 2021
Thanks a lot for your immediate answer, Stephan!
This should be the solution.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by