Add multiple doses in ODEsolver

조회 수: 11 (최근 30일)
Minu Pilvankar
Minu Pilvankar 2019년 9월 23일
답변: Arthur Goldsipe 2019년 9월 24일
I am trying to simulate multiple doses in a two compartment model. i have these odes for change in amount in each compartment.
d_amt_dt(1)= -(k12.*amt(1)) -(k10.*amt(1))+ (k21.*amt(2));
d_amt_dt(2) = (k12.*amt(1)) -(k21.*amt(2));
d_amt_dt = d_amt_dt';
For a single dose, I just change the initial condition amt1_0 = amount of dose given and get the expected output. However, how do I simulate multiple doses, e.g. every hour?
I can do this in Simbiology but I was wondering if there is a way to write code for that?

채택된 답변

Arthur Goldsipe
Arthur Goldsipe 2019년 9월 24일
Because doses introduce discontinuities in the solution, you basically need to stop the ODE simulation every time a dose is applied, update the appropriate states for the dose, and call the ODE solver with the updated initial conditions. This is what SimBiology does behind the scenes for you.

추가 답변 (1개)

darova
darova 2019년 9월 23일
There is way - ode45
To run your code every 1 hour look HERE

카테고리

Help CenterFile Exchange에서 Simulate Responses to Biological Variability and Doses에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by