Skip to content
Snippets Groups Projects
Commit 429c8112 authored by Paul CACHEUX's avatar Paul CACHEUX
Browse files

Model is now working

parent 470eb3b8
Branches
No related tags found
No related merge requests found
clear figure clear figure
N = 200; N = 4*365;
S = 990; S = 410000000;
I = 10; I = 55595;
R = 0; R = 0;
coeffs = options; coeffs = options;
coeffs.InfectionRate = 0.02; coeffs.InfectionRate = 2e-2;
coeffs.ImmunisationRate = 0.029; coeffs.ImmunisationRate = 0.029;
coeffs.ImmunisationLossRate = 2.7e-4; coeffs.ImmunisationLossRate = 2.7e-4;
coeffs.DeathRate = 1.3e-2; coeffs.DeathRate = 1.3e-2;
coeffs.NaturalDeathRate = 2e-5; coeffs.NaturalDeathRate = 2e-4;
coeffs.NatalityRate = 5e-5; coeffs.NatalityRate = 5.3e-4;
VaccinationVector = build_vacc_rate(2.4e-4, 2.4e-3, 50, N); VaccinationVector = build_vacc_rate(0, 4.4e-4, 0, N);
% VaccinationVector = build_vacc_rate(0, 0, 50, N); % VaccinationVector = build_vacc_rate(0, 0, 50, N);
model = model(S, I, R, 12, N); m = model(S, I, R, 12, N);
t = 1:N; t = 1:N;
for i=t for i=t
model.step(i, coeffs, VaccinationVector); m.step(i, coeffs, VaccinationVector);
end end
% figure % figure
...@@ -30,7 +30,7 @@ end ...@@ -30,7 +30,7 @@ end
% plot(t, Ilist); % plot(t, Ilist);
% plot(t, Rlist); % plot(t, Rlist);
% plot(t, Dlist); % plot(t, Dlist);
area([model.Slist.', model.Wlist.', model.Ilist.', model.Rlist.']); area([m.Slist.', m.Wlist.', m.Ilist.', m.Rlist.']);
legend('Susceptible', 'Waiting', 'Infected', 'Immunized'); legend('Susceptible', 'Waiting', 'Infected', 'Immunized');
title('Evolution of virus in population'); title('Evolution of virus in population');
......
...@@ -15,6 +15,7 @@ classdef model < handle ...@@ -15,6 +15,7 @@ classdef model < handle
repeat = 100; repeat = 100;
end end
obj.vector = zeros(1, 3 + Waiting);
obj.vector(1) = S; obj.vector(1) = S;
obj.vector(2) = I; obj.vector(2) = I;
obj.vector(3) = R; obj.vector(3) = R;
...@@ -34,6 +35,10 @@ classdef model < handle ...@@ -34,6 +35,10 @@ classdef model < handle
obj.Wlist(i) = sum(obj.vector(4:length(obj.vector))); obj.Wlist(i) = sum(obj.vector(4:length(obj.vector)));
obj.vector = step(obj.vector, coeffs, VaccinationVec(i)); obj.vector = step(obj.vector, coeffs, VaccinationVec(i));
end end
function goto(obj, other)
end
end end
end end
\ No newline at end of file
...@@ -11,9 +11,9 @@ for i=5:length(X) ...@@ -11,9 +11,9 @@ for i=5:length(X)
end end
if length(X) > 3 if length(X) > 3
% infecter = sum(X(4:length(X)) + I); % infection = S * (1 - 25 * options.InfectionRate / N) ^ I;
infection = S * (1 - 25 * options.InfectionRate / N) ^ I; infecter = sum(X(4:length(X)) + I);
% infection = options.InfectionRate * S * infecter/N; infection = options.InfectionRate * S * infecter/N;
new_waiting(1) = infection; new_waiting(1) = infection;
dS = -infection; dS = -infection;
dI = X(length(X)); dI = X(length(X));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment