From 429c8112ec75f3d9dfaae4c5a2428b305240fccd Mon Sep 17 00:00:00 2001 From: Paul CACHEUX <paulcacheux@gmail.com> Date: Sun, 10 Jun 2018 20:54:28 +0200 Subject: [PATCH] Model is now working --- SRI_matlab/main.m | 20 ++++++++++---------- SRI_matlab/model.m | 7 ++++++- SRI_matlab/step.m | 6 +++--- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/SRI_matlab/main.m b/SRI_matlab/main.m index b7274a5..4c03c90 100644 --- a/SRI_matlab/main.m +++ b/SRI_matlab/main.m @@ -1,27 +1,27 @@ clear figure -N = 200; +N = 4*365; -S = 990; -I = 10; +S = 410000000; +I = 55595; R = 0; coeffs = options; -coeffs.InfectionRate = 0.02; +coeffs.InfectionRate = 2e-2; coeffs.ImmunisationRate = 0.029; coeffs.ImmunisationLossRate = 2.7e-4; coeffs.DeathRate = 1.3e-2; -coeffs.NaturalDeathRate = 2e-5; -coeffs.NatalityRate = 5e-5; -VaccinationVector = build_vacc_rate(2.4e-4, 2.4e-3, 50, N); +coeffs.NaturalDeathRate = 2e-4; +coeffs.NatalityRate = 5.3e-4; +VaccinationVector = build_vacc_rate(0, 4.4e-4, 0, 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; for i=t - model.step(i, coeffs, VaccinationVector); + m.step(i, coeffs, VaccinationVector); end % figure @@ -30,7 +30,7 @@ end % plot(t, Ilist); % plot(t, Rlist); % 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'); title('Evolution of virus in population'); diff --git a/SRI_matlab/model.m b/SRI_matlab/model.m index 22b1430..8a1c0a7 100644 --- a/SRI_matlab/model.m +++ b/SRI_matlab/model.m @@ -14,7 +14,8 @@ classdef model < handle else repeat = 100; end - + + obj.vector = zeros(1, 3 + Waiting); obj.vector(1) = S; obj.vector(2) = I; obj.vector(3) = R; @@ -34,6 +35,10 @@ classdef model < handle obj.Wlist(i) = sum(obj.vector(4:length(obj.vector))); obj.vector = step(obj.vector, coeffs, VaccinationVec(i)); end + + function goto(obj, other) + + end end end \ No newline at end of file diff --git a/SRI_matlab/step.m b/SRI_matlab/step.m index eb70acb..eb13ac5 100644 --- a/SRI_matlab/step.m +++ b/SRI_matlab/step.m @@ -11,9 +11,9 @@ for i=5:length(X) end if length(X) > 3 - % infecter = sum(X(4:length(X)) + I); - infection = S * (1 - 25 * options.InfectionRate / N) ^ I; - % infection = options.InfectionRate * S * infecter/N; + % infection = S * (1 - 25 * options.InfectionRate / N) ^ I; + infecter = sum(X(4:length(X)) + I); + infection = options.InfectionRate * S * infecter/N; new_waiting(1) = infection; dS = -infection; dI = X(length(X)); -- GitLab