Solving System of ODE with global condition

조회 수: 1 (최근 30일)
Cone
Cone 2021년 4월 19일
댓글: Cone 2021년 4월 19일
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
Cone
Cone 2021년 4월 19일
Thanks a lot for your immediate answer, Stephan!
This should be the solution.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by