Simulation of Medicinal Drug Blood Levels

DRUG_DOSAGE a MATLAB program which simulates the variation in the blood levels of a medicinal drug being administered at specific dosages and times over a course of treatment. The level should rise about a given medicinal level for some time, but stay below the toxic level.

The drug level can be modeled by a pair of first-order linear differential equations. If we define:

  A = medicine_in_intestines,
  B = plasma_level.  
then the governing differential equations are:
  dA/dt = - absorption_rate * A + intake
  dB/dt = - excretion_rate  * B + absorption_rate * A


The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.


DRUG_DOSAGE is available in a MATLAB version and a Python version.

Related Data and Programs:


FD_PREDATOR_PREY, a MATLAB program which applies the finite difference method (FDM) to a predator-prey system with time dependence and no spatial variation.

FD1D_HEAT_EXPLICIT, a MATLAB program which uses the finite difference method and explicit time stepping to solve the time dependent heat equation in 1D.

LORENZ_ODE, a MATLAB program which approximates solutions to the Lorenz system, creating graphics output using matplotlib.

SIR, a MATLAB program which simulates the spread of a disease using the Susceptible/Infected/Recovered (SIR) model.

THREE_BODY_SIMULATION, a MATLAB program which simulates the behavior of three planets, constrained to lie in a plane, and moving under the influence of gravity, by Walter Gander and Jiri Hrebicek.


  1. Soraya Dhillon, Andrzej Kostrzewski,
    Clinical Pharmacokinetics,
    Pharamceutical Press, 2006,
    ISBN: 978-0-85369-571-4.

Source Code:

Last revised on 08 January 2019.