How to code two function that is separated by time
Afficher commentaires plus anciens
Hi,
I try to code the attached equation but unable to get it work correctly. My goal is to plot those two function in one figure.
Here's my original code:
%calculate the plasma pharmacokinetics for continous injection
% I used term... to simplify the long formula
Dd = 50;
Td = 3600;
A1 = 74.6;
alpha1 = 2.43*(10^(-3));
A2 = 2.49;
alpha2 = 2.83*(10^(-4));
A3 = 0.552;
alpha3 = 1.18*(10^(-5));
t = 0:32400;
term1 = (A1/alpha1)*(1-(exp(-alpha1*t)));
term2 = (A2/alpha2)*(1-(exp(-alpha2*t)));
term3 = (A3/alpha3)*(1-(exp(-alpha3*t)));
term4 = (A1/alpha1).*((exp(-alpha1*t))-1).*(exp(-alpha1*t));
term5 = (A2/alpha2).*((exp(-alpha2*t))-1).*(exp(-alpha2*t));
term6 = (A3/alpha3).*((exp(-alpha3*t))-1).*(exp(-alpha3*t));
if (t<Td)
Cv=(Dd/Td).*(term1+term2+term3);
elseif (t>Td)
Cv=(Dd/Td).*(term4+term5+term6);
end
%calculate free doxorubicin concentration in plasma (Cfp)
s = 0.25;
Cfp = s*Cv;
figure(1);plot (t/3600,Cfp); hold on
%calculate bound doxorubicin concentration in plasma (Cfp)
Cbp = (1-s)*Cv;
plot (t/3600,Cbp);
ylabel ('Concentration Doxorubicin in Plasma for Continuous Injection ');
xlabel ('Time (hours)');
legend('Cfp=free doxorubicin','Cbp=bound doxorubicin');
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!