-
Notifications
You must be signed in to change notification settings - Fork 0
/
runBatchesSIR.m
51 lines (34 loc) · 966 Bytes
/
runBatchesSIR.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
48
49
50
51
%%%
%
% Script for running the stochastic SIR model. You may give the simulation the number of
% batches you wish to run. Will return Ntimes x Nbatches.
%
%%%
addpath("./plottingTools/")
addpath("./Model&Tools/")
Npop = 10^19;
Simpop = 10^5; InInitial = 1;
aplha = 0.7; beta = 1/20;
V = 1;
Tsart = 0; Tend = 50;
Nbatches = 100;
Times = linspace(Tsart,Tend,5000);
[outSn, outIn, outRn] = SIRmc(Tsart, Tend, V, aplha, beta, Simpop, InInitial,Nbatches,Times, Npop);
figure
set(gcf, 'Position', [500, 1000, 1000, 800])
p1 = plot(Times,outSn, 'g');
hold on
p2 = plot(Times,outIn, 'r');
p3 = plot(Times,outRn, 'b');
legend('Susceptable','Infected', 'Recovered')
xlim([0 Tend])
for i=1:length(p1)
p1(i).Color(4) = 0.6;
p2(i).Color(4) = 0.6;
p3(i).Color(4) = 0.6;
end
title("Stochastic SIR model")
xlabel("Time [arb]")
ylabel("% of Population")
set(gca,'FontName','Arial','FontSize',22);
%sliceTime(0.7,outSn,outIn,outRn,Times)