Plotting disease prevalence vs time
2 views (last 30 days)
Show older comments
Prevalence is the proportion of cases in the population at a given time. Mathematically, prevalence = number of cases/number of total populations. I have proposed a mathematical model with seven compartments, of which five of them are classes of human population x(1), x(2), x(3), x(5) & x(6). Infectious classes are: x(2), x(3), x(5) & x(6). Accordingly,
Prevalence = [x(2)+x(3)+x(5)+x(6)]/N
where N = x(1)+x(2)+x(3)+x(5)+x(6).
My Question:
I want to plot the effects of varying a given parameter (for instance, eta) on the prevalence of a disease. To do this, I tried many times using the following ode45 solver (MATLAB), but I couldn't get any plot and displays an error. Could you tell me please where my problem is? Thanks in advance!
function fun
function dxdt = fun(t,x);
N = x(1)+x(2)+x(3)+x(5)+x(6);
lambda1 = beta1*(x(2)+theta*x(3))/N+eta*(1-1/((1+x(4))*(1+x(7))))*x(4)/(x(4)+x(7));
lambda2 = beta2*(x(5)+theta*x(6))/N+eta*(1-1/((1+x(4))*(1+x(7))))*x(7)/(x(4)+x(7));
dxdt = [pi-(lambda1+lambda2+mu)*x(1)+(1-p)*r1*x(2)+r2*x(5);
(1-alpha)*lambda1*x(1)-(1-alpha)*lambda2*x(2)-(mu+d1+r1)*x(2)+phi1*x(3);
alpha*lambda1*x(1)-lambda2*x(3)-(mu+phi1)*x(3);
delta1*x(2)+omega1*x(3)-xi1*x(4);
(1-alpha)*lambda2*(x(1)+x(2)+x(3))+p*r1*x(2)-(mu+d2+r2)*x(5)+phi2*x(6);
alpha*lambda2*(x(1)+x(3))-(mu+phi2)*x(6); delta2*x(5)+omega2*x(6)-xi2*x(7)];
function f = prevalence(t,x)
f=(x(2)+x(3)+x(5)+x(6))/N;
end
end
close all; clear all; clc;
%Define parameter values below
beta1=0.006;beta2=0.0052;theta=0.35;mu=0.0005;d1=0.00125;d2=0.002;
r1=0.02;r2=0.015;p=0.01;phi1=0.00096;phi2=0.0017;alpha=0.3;pi=1000000/52;
eta=1.379*10^-10; xi1=0.2415;xi2=0.2415;delta1=1;
delta2=1.05;omega1=0.05; omega2=0.06;
for eta=0.0000007:0.0000003:0.0000013
[t,x]=ode45(@fun,[0 200],[10000 500 450 100000 300 200 100000])
hold on
if eta==0.0000007
plot(t,f,'r-.','linewidth',1);
elseif eta==0.000001
plot(t,f,'b-.','linewidth',1);
else
plot(t,f,'g-.','linewidth',1);
end
xlabel('Time (weeks)');
ylabel('Prevalence')
end
end
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!