필터 지우기
필터 지우기

Modelling a system of ODEs and need to add inputs after t=0?

조회 수: 16 (최근 30일)
Daniel Bending
Daniel Bending 2020년 4월 24일
댓글: Sietse Braakman 2020년 5월 1일
Hi all,
I'm testing a pharmacokinetic model in MATLAB, it's very stiff so I'm currently using ode15s, the system is comprised of 7 interconnected ODEs representing various 'compartments' within the body.
My issue is as follows: I'm attempting to forward model the system based on a fitted parameter set, in order to model is accurately I need to mimic the inputs as done in the original in vivo trials. There in one input at t=10s and two further inputs at t=60s.
I've attempted a work around, just attempting to brute force it in the function but that led the solver to complain about infinitely small step sizes so I assume I broke something.
Any suggestions would be fantastic! Thank you.

채택된 답변

Star Strider
Star Strider 2020년 4월 24일
I am not exactly certain what you are doing or what your pharmacokinetic model is. Not knowing more, I would do something like this (assuming ‘t’ is the time vector and the integrated values are stored in matrix ‘y’):
Use first set of initial conditions ‘ic’
tspan = linspace(0, 10, 10);
Run ode15s with your ODE function
ic = y(end,:);
t0 = t(end);
ic(appropriate_compartment) = dose(1);
Use new set of initial conditions ‘ic’
tspan = linspace(t0, t0+60, 60);
Run ode15s with your ODE function
ic = y(end,:);
t0 = t(end);
ic(appropriate_compartment) = dose(2);
... continuing for as many steps as necessary. Adjust the number of elements in ‘tspan’ with the third argument of linspace. You will need to vertically concatenate the ‘t’ vectors and ‘y’ matrices from each step (loop iteration) to create the complete simulation.
I’m simply sketching this, corresponding to similar problems I’ve worked on.
Apparently the SimBiology has a set of functions that will make alll this straightforward, although I have no experience with it. (I don’t do such simulations frequently enought to justify buying it.)
  댓글 수: 8
Star Strider
Star Strider 2020년 4월 25일
Thank you!
I understand. If at some point you’d like my help in solving it, post back here with the model and the data and I’ll do my best to identify it correctly and simulate it.
In the interim, see: Parameter Estimation for a System of Differential Equations. That’s likely the most concise of such posts. There are others, including some that use the ga (genetic algorithm) to estimate the parameters.
Sietse Braakman
Sietse Braakman 2020년 5월 1일
Hi Daniel,
One of the problems you are running into is the fact that you need to restart the ODE solver, every time you dose/perturb the model. SimBiology can really help here, as it takes care of the ODE solver restarts and makes dosing much easier. The function sbiofit (or a fit program in the Model Analyzer App) will allow you to set up parameter estimations easily and iterate through different algorithms, try out different error models. Primarily, it constructs the objective function for you.
PM me if this is of interest - I can help you get started with SimBiology.
Best,
Sietse

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scan Parameter Ranges에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by