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

Suppression des /N aux mauvais endroits

parent 02a08472
Branches
No related tags found
No related merge requests found
......@@ -16,7 +16,7 @@ coeffs.DeathRate = 0.04;
coeffs.NaturalDeathRate = 0.002;
coeffs.NatalityRate = 0.003;
N = 10000;
N = 30;
Slist = zeros(1, N);
Ilist = zeros(1, N);
......@@ -25,10 +25,10 @@ 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);
input = step(input, coeffs)
end
% figure
......@@ -43,4 +43,4 @@ 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
axis([1, N, 0, inf]);
\ No newline at end of file
......@@ -5,9 +5,9 @@ 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;
dS = -options.InfectionRate * S * I/N - options.VaccinationRate * S + options.ImmunisationLossRate * R + options.NatalityRate - options.NaturalDeathRate * S;
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;
dR = options.ImmunisationRate * I + options.VaccinationRate * S - options.ImmunisationLossRate * R - options.NaturalDeathRate * R;
res = [S + dS, I + dI, R + dR];
res = [max(S + dS, 0), max(I + dI, 0), max(R + dR, 0)];
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