I have a ODE system with three variables, $B$- bacteria, $C$-total antibiotic concentration and $C_f$- free drug concentration.
${dB\over dt}=rB-C_fB$.
${dC\over dt}=-\delta C_f$ where
$C_f=1/2*[-(P+K_d-C)+\sqrt{(P+K_d-C)^2+4 K_d C}]$
$r, \delta, K_d, P$ are known constant values. So this system describes bacterial killing through an antibiotic. Here the antibiotic killing should happen based on the free drug concentration ($C_f$. As $C$ decays over time the values of $C_f$ can be computed at each time point. I wrote the code for this in Matlab and can I please know whether
- based on the way I have written, the correct calculated $C_f$ value gets used to kill the bacteria?
- Is there a way to out put the value of $C_f$ through the function 'odeModel' rather than separately calculating the value of $C_f$ outside by using the ODE solution obtained for $C$?
y0=[1000,20]; %initial conditions
[t,y]=ode45(@(t,y)odeModel(t,y),0:1:1000,y0);
function s= odeModel(~,y)
r1=1;%replication rate of bacteria
nP=1*10^4;%total concentration of protein binding sites (bound and free)
Kd=1/(1*10^-4);%disassociation constant of the drug protein complex
delta=0.08;%decay rate of drug
s=zeros(2,1);
s(2)=-(delta/2)*(-(nP+Kd-y(2))+((nP+Kd-y(2))^2+4*Kd*y(2))^0.5);%%the total drug concentration
Cf=(-(nP+Kd-y(2))+((nP+Kd-y(2))^2+4*Kd*y(2))^0.5)/2;%concentration of the free drug.
s(1)=r1*y(1)- y(1)*Cf ;%rate of change of bacteria
end
Your
Cflooks correct.To get values of
Cfyou can changeodeModelto give it as an output argument, then once you've solved the ode, you can get the values ofCfby running:This is the modified
odeModelfunction: