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

Ajout vaccination modulaire, et differents step (waiting) pour l'infection

parent 3fd5b168
No related branches found
No related tags found
No related merge requests found
clear figure clear figure
N = 180;
S = 990; S = 990;
I = 50; I = 10;
R = 0; R = 0;
n_pop = S + I + R;
input = [S, I, R]; % input = [S, I, R];
input = build_input(S, I, R, 12);
coeffs = options; coeffs = options;
coeffs.InfectionRate = 0.09; coeffs.InfectionRate = 0.6;
coeffs.ImmunisationRate = 0.005; coeffs.ImmunisationRate = 0.04;
coeffs.ImmunisationLossRate = 0.001; coeffs.ImmunisationLossRate = 2.7e-4;
coeffs.VaccinationRate = 0.02; coeffs.DeathRate = 1.3e-3;
coeffs.DeathRate = 0.04; coeffs.NaturalDeathRate = 2e-5;
coeffs.NaturalDeathRate = 0.002; coeffs.NatalityRate = 5e-5;
coeffs.NatalityRate = 0.003; % VaccinationRate = build_vacc_rate(0, 2.4e-4, 50, N);
VaccinationRate = build_vacc_rate(0, 0, 50, N);
N = 1000;
Slist = zeros(1, N); Slist = zeros(1, N);
Wlist = zeros(1, N);
Ilist = zeros(1, N); Ilist = zeros(1, N);
Rlist = zeros(1, N); Rlist = zeros(1, N);
...@@ -28,7 +30,8 @@ for i=t ...@@ -28,7 +30,8 @@ for i=t
Slist(i) = input(1); Slist(i) = input(1);
Ilist(i) = input(2); Ilist(i) = input(2);
Rlist(i) = input(3); Rlist(i) = input(3);
input = step(input, coeffs); Wlist(i) = sum(input(4:length(input)));
input = step(input, coeffs, VaccinationRate(i));
end end
% figure % figure
...@@ -37,10 +40,31 @@ end ...@@ -37,10 +40,31 @@ end
% plot(t, Ilist); % plot(t, Ilist);
% plot(t, Rlist); % plot(t, Rlist);
% plot(t, Dlist); % plot(t, Dlist);
area([Slist.', Ilist.', Rlist.']); area([Slist.', Wlist.', Ilist.', Rlist.']);
legend('Susceptible', 'Infected', 'Immunized'); legend('Susceptible', 'Waiting', 'Infected', 'Immunized');
title('Evolution of virus in population'); title('Evolution of virus in population');
xlabel('Time'); xlabel('Time');
ylabel('Population'); ylabel('Population');
axis([1, N, 0, inf]); axis([1, N, 0, inf]);
% utility functions
function input=build_input(S, I, R, Waiting)
input(1) = S;
input(2) = I;
input(3) = R;
for i = 1:Waiting
input(3+i) = 0;
end
end
function vacc_rate=build_vacc_rate(start_rate, end_rate, change_step, N)
vacc_rate = zeros(1, N);
for i=1:change_step
vacc_rate(i) = start_rate;
end
for i=change_step+1:N
vacc_rate(i) = end_rate;
end
end
\ No newline at end of file
...@@ -3,7 +3,6 @@ classdef options ...@@ -3,7 +3,6 @@ classdef options
InfectionRate InfectionRate
ImmunisationRate ImmunisationRate
ImmunisationLossRate ImmunisationLossRate
VaccinationRate
DeathRate DeathRate
NaturalDeathRate NaturalDeathRate
NatalityRate NatalityRate
......
function res = step(X, options) function res = step(X, options, VaccinationRate)
S = X(1); S = X(1);
I = X(2); I = X(2);
R = X(3); R = X(3);
N = S + I + R; N = sum(X);
dS = -options.InfectionRate * S * I/N - options.VaccinationRate * S + options.ImmunisationLossRate * R + options.NatalityRate * N - options.NaturalDeathRate * S; new_waiting = zeros(1, length(X) - 3);
dI = options.InfectionRate * S * I/N - options.ImmunisationRate * I - options.DeathRate * I; for i=5:length(X)
dR = options.ImmunisationRate * I + options.VaccinationRate * S - options.ImmunisationLossRate * R - options.NaturalDeathRate * R; new_waiting(i - 3) = X(i - 1) * (1 - options.NaturalDeathRate);
end
if length(X) > 3
infecter = sum(X(4:length(X)) + I);
new_waiting(1) = options.InfectionRate * S * infecter/N;
dS = -options.InfectionRate * S * infecter/N;
dI = X(length(X));
else
dS = -options.InfectionRate * S * I/N;
dI = options.InfectionRate * S * I/N;
end
dS = dS - VaccinationRate * S + options.ImmunisationLossRate * R + options.NatalityRate * N - options.NaturalDeathRate * S;
dI = dI - options.ImmunisationRate * I - options.DeathRate * I;
dR = options.ImmunisationRate * I + VaccinationRate * S - options.ImmunisationLossRate * R - options.NaturalDeathRate * R;
res = [max(S + dS, 0), max(I + dI, 0), max(R + dR, 0)]; res = [max(S + dS, 0), max(I + dI, 0), max(R + dR, 0), new_waiting];
end end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment