Code covered by the BSD License  

Highlights from
RGDS_Practical_Guide

image thumbnail

RGDS_Practical_Guide

by

 

15 Mar 2013 (Updated )

MATLAB routines for the book: "Development of Innovative Drugs via Modeling with MATLAB".

PK1IV1a
function PK1IV1a
%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;
plot(t,a,'-r',t,c,'b-','lineWidth',2)
legend('Drug amounts [mg]','Drug concentrations [mg/L]')
xlabel('Time [h]')
ylabel('Value')
print('-dtiff','-r900','PK1IV1a.tif')

end 	


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;

end

Contact us