Add second year

This commit is contained in:
2023-12-07 01:19:12 +00:00
parent 3291e5c79e
commit 3d12031ab8
1168 changed files with 431409 additions and 0 deletions

View File

@ -0,0 +1,15 @@
function dydt = SIR(t, x, c, i, alpha, beta, gamma)
dydt = [0; 0; 0; 0; 0];
S = x(1);
I = x(2);
R = x(3);
H = x(4);
RH = x(5);
N = S + I + R + H + RH;
dydt(1) = (-c*S) * (I/N) * i;
dydt(2) = (c*S) * (I/N) * i - (alpha*I);
dydt(3) = (alpha*I) - (beta*R);
dydt(4) = (beta*R) - (gamma*H);
dydt(5) = gamma*H;
end

View File

@ -0,0 +1,40 @@
clear;
i = 0.125;
alpha = 0.25;
beta = 0.02;
gamma = 0.10;
time_vec = 0:.25:100;
init_vec = [9999 1 0 0 0];
c = linspace(3, 8, 20);
infected_stock = zeros(length(time_vec), 20);
in_hospital = zeros(length(time_vec), 20);
for loopcounter = 1:20
[t,y] = ode45(@SIR, ...
time_vec, ...
init_vec, ...
odeset, ...
c(loopcounter), ...
i, ...
alpha, ...
beta, ...
gamma);
infected_stock(:, loopcounter) = y(:,2);
in_hospital(:,loopcounter) = y(:,4);
end
subplot(3, 1, 1);
plot(time_vec, infected_stock);
title("Infected Stock");
subplot(3, 1, 2);
plot(time_vec, infected_stock);
title("People in Hospital");
subplot(3,1,3);
scatter(c, max(in_hospital));
title("Contacts v Peak in Hospital");