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".

AUC
function AUC
%AUC Compute Area Under the curve. 

% specify model parameters
p.ka = 1;   % absorption rates 
p.V  = 15;  % volume of distribution 
p.F  = 1;   % bioavailability 
p.CL = 5;   % clearance
% initial values
a0 = 10; c0 = 0; AUC0 = 0; y0 = [a0; c0; AUC0]; tspan = [0 15];
[t,y] = ode15s(@derivatives, tspan, y0, [], p);
set(axes,'FontSize',15); plot(t,y(:,2),'Color','k','LineWidth',3); 
hold on; grid on; xlabel('Time'); ylabel('Concentration');
area(t,y(:,2),'FaceColor', [0.9 0.9 0.9])
legend('conc', ['AUC = ',num2str(y(end,3))])
print('-r800', '-dtiff', 'AUC') 

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|, and time |T|, and with parameters |P|.

a = y(1);           % drug amount                                
c = y(2);           % concentration 
% yAUC = y(3);      % variable linked to AUC can be omitted 
% PK Model
dadt    = -p.ka*a;
dcdt    = p.ka/p.V/p.F*a - p.CL/p.V*c;
dyAUCdt = c;        % !!! derivative added to compute AUC 
% Derivatives vector of ODE system
dydt = [dadt; dcdt; dyAUCdt]; 

end


Contact us