MATLAB Code
Implements the midazolam model of Barr et al.[1]
Contributed by Jeff E Mandel
function sys = midazolam (mPatient, stepSize)
% Implements Barr model with a 5 minute tpeak
% Barr J, Zomorodi K, Bertaccini EJ, Shafer SL, Geller E. A double-blind,
% randomized comparison of i.v. lorazepam versus midazolam for sedation of
% ICU patients via a pharmacologic model. Anesthesiology. 2001;95:286-98.
age = min(mPatient.Age,70);
volume = 1';
clearance = 2';
% volume = 3;
% clearance = [.43 .56 .39];
% Solve for the value of ke0 which yields a time to peak effect of 5
% minutes. We search in the range of .1 to 2.0
tpeak = 5;
ike0 = [.001;2];
t=0:.0005:25;
u=zeros(size(t));
u(1)=1;
options = optimset('Display','off'); % Turn off Display
ke0 = fzero(@getKe0, ike0, options);
%disp(ke0);
function [error] = getKe0(tke0)
[sys] = mam2ss(clearance,volume,tke0);
[y,t] = lsim(sys,u,t);
s = lsiminfo(y,t,0); % final value is 0
error = tpeak - s.MaxTime;
end
sys = mam2ss(clearance,volume,ke0);
if (nargin==2)
sys=c2d(sys, stepSize,'zoh');
end
function [sys] = mam2ss(clearance,volume, ke0)
% returns a state space model from vectors of clearance
% and compartment volumes. All states are drug amount
% in the compartment; to get concentration, divide by compartment
% volume in the C matrix. Note that this code can handle an
% arbitrary number of compartments, but assumes the first compartment is
% the central compartment (mam is short for mamillary).
% The effect site compartment is represented as a compartment of negligible
% volume adjoined to the central compartment.
n = length(clearance);
if (nargin == 2)
k1 = clearance./volume(1);
k2 = clearance(2:n)./volume(2:n);
A = [-sum(k1) k2;transpose(k1(2:n)) -diag(k2)];
B = [1;zeros(n-1,1)]; % Direct addition of drug into the central compartment
C = [1/volume(1) zeros(1,n-1)]; % Observation of the central compartment concentration.
else
EFFECT_VOL_FACTOR=10000; % ratio of central compartment vol to effect
k1 = [clearance./volume(1) ke0/EFFECT_VOL_FACTOR];
k2 = [clearance(2:n)./volume(2:n) ke0];
A = [-sum(k1) k2;transpose(k1(2:n+1)) -diag(k2)];
B = [1;zeros(n,1)]; % Direct addition of drug into the central compartment
C = [zeros(1,n) EFFECT_VOL_FACTOR/volume(1)]; % Observation of the effect site compartment concentration.
end
C = C/1000.; % All compartment volumes are in L, convert to ml
D=0;
sys = ss(A,B,C,D);
end
end
- Barr J, Zomorodi K, Bertaccini E, Shafer S, Geller E: A double-blind, randomized comparison of i.v. lorazepam versus midazolam for sedation of ICU patients via a pharmacologic model. Anesthesiology 2001; 95:286–98 PMID: 11506097