-
Notifications
You must be signed in to change notification settings - Fork 0
/
runBatchesSIRSpain.m
72 lines (53 loc) · 1.63 KB
/
runBatchesSIRSpain.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%%%
%
% 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 = 47*10^6;
Simpop = Npop;
p1 = 5/100; p2 = 6.5/100; p3 = 4.5/100; p4 = 55/100;
%[betaBefore, betaAfter, gamma1, gamma2, gamma3, alpha1, alpha2, alpha3, eta, d1, d2, delta, tau]
rates = [0.59, 0.1, 1/5.2, p2/5.8, p3/1, (1-p1)/14, (1-p2-p3)/7, (1-p4)/14, 1/6, p2/7.5, p4/8, 70.36/100, 0.1];
Tsart = 0; Tend = 2*30;
QuarentineT = 10000;
Nbatches = 1;
Times = linspace(Tsart,Tend,5000);
In = 15*10^3;
Ln = 11*10^3;
Sn = Npop - Ln - In;
Rn = 0;
Qn = 0;
Hn = 0;
Un = 0;
HUn= 0;
Fn = 0;
InInitial = [Sn, In, Rn, Qn, Ln, Hn, Un, HUn, Fn]/Npop * Simpop;
[outSn, outIn, outRn, outQn, outLn, outHn, outUn, outHUn, outFn] = SpainMC(Tsart, Tend, QuarentineT, rates, InInitial, Nbatches,Times, Simpop, 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');
p2 = plot(Times,outQn, 'Color',[1,0.5,0.5]);
p3 = plot(Times,outLn, 'y');
p2 = plot(Times,outHn, 'c');
p3 = plot(Times,outUn, 'm');
p2 = plot(Times,outHUn,'Color', [0.5,0.5,1]);
p3 = plot(Times,outFn, 'k');
legend('Susceptable','Infected', 'Recovered', 'Q', 'L', 'H', 'U', 'HU', 'F')
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("Number of Population")
set(gca,'FontName','Arial','FontSize',22);
%sliceTime(0.7,outSn,outIn,outRn,Times)