-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunSIR.m
47 lines (35 loc) · 1 KB
/
runSIR.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
%%%
%
% Script for running the stochastic SIR model
% Plots the batches from a single stochastic simulation, as they are
% calculated
%
% Author: Ander Gray
% Email: [email protected]
%%%
figure
set(gcf, 'Position', [500, 1000, 1000, 800])
for i= 1:100
TotalPop = 10^6;
SimPop = 1000; InInitial = 1;
aplha = 2; beta = 1;
V = 100;
outT = linspace(0,10,1000);
Tsart = 0; Tend = 100;
[outSn, outIn, outRn] = SIRmc(Tsart, Tend, V, aplha, beta, Npop, InInitial,1,outT,TotalPop);
p1 = plot(outT,outSn, 'g');
p1.Color(4) = 0.2;
hold on
p2 = plot(outT,outIn, 'r');
p2.Color(4) = 0.2;
p3 = plot(outT,outRn, 'b');
p3.Color(4) = 0.2;
xlim([0 15])
title("Stochastic SIR model")
xlabel("Time [arb]")
ylabel("% of Population")
legend('Susceptable','Infected', 'Recovered')
set(gca,'FontName','Arial','FontSize',22);
drawnow();
pause(0.01)
end