15 Mar 2013
09 Dec 2013)
MATLAB routines for the book: "Development of Innovative Drugs via Modeling with MATLAB".
%PK1IV1a Sequential calculation of drug amounts and concentrations.
% PK1IV1a sequentially calculates drug amounts and drug
% concentrations for a one-compartment PK model with IV
% input and first-order elimination.
%clear; clc; close all;
p.V = 5.0; % L
p.k10 = 1.0; % mg/h
dose = 100; % mg
timeEnd = 10; % h
[t,y] = ode45(@derivatives, [0 timeEnd], dose, , p);
a = y;
c = a/p.V;
legend('Drug amounts [mg]','Drug concentrations [mg/L]')
function dydt = derivatives(~, y, p)
%DERIVATIVES Compute the right-hand side of the ODE.
% DYDT = DERIVATIVES(T, Y, P) calculates |DYDT|, the right-hand
% side of the ODE model, at points defined by the vector of
% dependent variables |Y|, time |T|, and with parameters |P|.
a1 = y(1);
da1 = - p.k10*a1;
dydt = da1;