diff --git a/SRI_matlab b/SRI_matlab deleted file mode 160000 index e1cf190f20b898a299b35b52dd8141a6558306e8..0000000000000000000000000000000000000000 --- a/SRI_matlab +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e1cf190f20b898a299b35b52dd8141a6558306e8 diff --git a/SRI_matlab/main.m b/SRI_matlab/main.m new file mode 100644 index 0000000000000000000000000000000000000000..bd93d8cf516aa48ba968507cecbc67c7b85281a8 --- /dev/null +++ b/SRI_matlab/main.m @@ -0,0 +1,46 @@ +clear figure + +S = 990; +I = 10; +R = 0; +n_pop = S + I + R; + +input = [S, I, R]; + +coeffs = options; +coeffs.InfectionRate = 0.06; +coeffs.ImmunisationRate = 0.01; +coeffs.ImmunisationLossRate = 0.001; +coeffs.VaccinationRate = 0.02; +coeffs.DeathRate = 0.04; +coeffs.NaturalDeathRate = 0.002; +coeffs.NatalityRate = 0.003; + +N = 10000; + +Slist = zeros(1, N); +Ilist = zeros(1, N); +Rlist = zeros(1, N); + +t = 1:N; + +for i=t + input = step(input, coeffs); + Slist(i) = input(1); + Ilist(i) = input(2); + Rlist(i) = input(3); +end + +% figure +% hold on +% plot(t, Slist); +% plot(t, Ilist); +% plot(t, Rlist); +% plot(t, Dlist); +area([Slist.', Ilist.', Rlist.']); + +legend('Susceptible', 'Infected', 'Immunized'); +title('Evolution of virus in population'); +xlabel('Time'); +ylabel('Population'); +% axis([1, N, 0, n_pop]); \ No newline at end of file diff --git a/SRI_matlab/options.m b/SRI_matlab/options.m new file mode 100644 index 0000000000000000000000000000000000000000..3dfd8dc5ffd9fc7c2f1ee3b4fccc6f45a6793595 --- /dev/null +++ b/SRI_matlab/options.m @@ -0,0 +1,22 @@ +classdef options + properties + InfectionRate + ImmunisationRate + ImmunisationLossRate + VaccinationRate + DeathRate + NaturalDeathRate + NatalityRate + end + + properties(Dependent) + R0 + end + + methods + function R0=get.R0(obj) + R0 = obj.InfectionRate / (obj.ImmunisationRate + obj.DeathRate + obj.VaccinationRate); + end + end +end + diff --git a/SRI_matlab/step.m b/SRI_matlab/step.m new file mode 100644 index 0000000000000000000000000000000000000000..067cd39ee0071189a57e1837599d9d6009a349c1 --- /dev/null +++ b/SRI_matlab/step.m @@ -0,0 +1,13 @@ +function res = step(X, options) +S = X(1); +I = X(2); +R = X(3); + +N = S + I + R; + +dS = -options.InfectionRate * S * I / N - options.VaccinationRate * S / N + options.ImmunisationLossRate * R + options.NatalityRate - options.NaturalDeathRate * S/N; +dI = options.InfectionRate * S * I / N - options.ImmunisationRate * I - options.DeathRate * I; +dR = options.ImmunisationRate * I + options.VaccinationRate * S / N - options.ImmunisationLossRate * R - options.NaturalDeathRate * R/N; + +res = [S + dS, I + dI, R + dR]; +end \ No newline at end of file