Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dynamique-populations
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Martin Lehoux
dynamique-populations
Commits
61dd3db1
Commit
61dd3db1
authored
7 years ago
by
Paul CACHEUX
Browse files
Options
Downloads
Patches
Plain Diff
Extracted model functionnality
parent
6781ca74
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
SRI_matlab/main.m
+5
-24
5 additions, 24 deletions
SRI_matlab/main.m
SRI_matlab/model.m
+39
-0
39 additions, 0 deletions
SRI_matlab/model.m
SRI_matlab/step.m
+1
-1
1 addition, 1 deletion
SRI_matlab/step.m
with
45 additions
and
25 deletions
SRI_matlab/main.m
+
5
−
24
View file @
61dd3db1
...
...
@@ -6,9 +6,6 @@ S = 990;
I
=
10
;
R
=
0
;
% input = [S, I, R];
input
=
build_input
(
S
,
I
,
R
,
12
);
coeffs
=
options
;
coeffs
.
InfectionRate
=
0.02
;
coeffs
.
ImmunisationRate
=
0.029
;
...
...
@@ -16,22 +13,15 @@ coeffs.ImmunisationLossRate = 2.7e-4;
coeffs
.
DeathRate
=
1.3e-2
;
coeffs
.
NaturalDeathRate
=
2e-5
;
coeffs
.
NatalityRate
=
5e-5
;
Vaccination
Rate
=
build_vacc_rate
(
2.4e-4
,
2.4e-3
,
50
,
N
);
% Vaccination
Rate
= build_vacc_rate(0, 0, 50, N);
Vaccination
Vector
=
build_vacc_rate
(
2.4e-4
,
2.4e-3
,
50
,
N
);
% Vaccination
Vector
= build_vacc_rate(0, 0, 50, N);
Slist
=
zeros
(
1
,
N
);
Wlist
=
zeros
(
1
,
N
);
Ilist
=
zeros
(
1
,
N
);
Rlist
=
zeros
(
1
,
N
);
model
=
model
(
S
,
I
,
R
,
12
,
N
);
t
=
1
:
N
;
for
i
=
t
Slist
(
i
)
=
input
(
1
);
Ilist
(
i
)
=
input
(
2
);
Rlist
(
i
)
=
input
(
3
);
Wlist
(
i
)
=
sum
(
input
(
4
:
length
(
input
)));
input
=
step
(
input
,
coeffs
,
VaccinationRate
(
i
));
model
.
step
(
i
,
coeffs
,
VaccinationVector
);
end
% figure
...
...
@@ -40,7 +30,7 @@ end
% plot(t, Ilist);
% plot(t, Rlist);
% plot(t, Dlist);
area
([
Slist
.
', Wlist.'
,
Ilist
.
', Rlist.'
]);
area
([
model
.
Slist
.
',
model.
Wlist.'
,
model
.
Ilist
.
',
model.
Rlist.'
]);
legend
(
'Susceptible'
,
'Waiting'
,
'Infected'
,
'Immunized'
);
title
(
'Evolution of virus in population'
);
...
...
@@ -50,15 +40,6 @@ axis([1, N, 0, inf]);
% utility functions
function
input
=
build_input
(
S
,
I
,
R
,
Waiting
)
input
(
1
)
=
S
;
input
(
2
)
=
I
;
input
(
3
)
=
R
;
for
i
=
1
:
Waiting
input
(
3
+
i
)
=
0
;
end
end
function
vacc_rate
=
build_vacc_rate
(
start_rate
,
end_rate
,
change_step
,
N
)
vacc_rate
=
zeros
(
1
,
N
);
for
i
=
1
:
change_step
...
...
This diff is collapsed.
Click to expand it.
SRI_matlab/model.m
0 → 100644
+
39
−
0
View file @
61dd3db1
classdef model
<
handle
properties
vector
Slist
Ilist
Rlist
Wlist
end
methods
function
obj=
model(S,
I
,
R
,
Waiting
,
N
)
if
nargin
>
4
repeat = N;
else
repeat = 100;
end
obj.vector(1) = S;
obj.vector(2) = I;
obj.vector(3) = R;
for i = 1:Waiting
obj.vector(3+i) = 0;
end
obj.Slist = zeros(1, repeat);
obj.Ilist = zeros(1, repeat);
obj.Rlist = zeros(1, repeat);
obj.Wlist = zeros(1, repeat);
end
function step(obj, i, coeffs, VaccinationVec)
obj.Slist(i) = obj.vector(1);
obj.Ilist(i) = obj.vector(2);
obj.Rlist(i) = obj.vector(3);
obj.Wlist(i) = sum(obj.vector(4:length(obj.vector)));
obj.vector = step(obj.vector, coeffs, VaccinationVec(i));
end
end
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
SRI_matlab/step.m
+
1
−
1
View file @
61dd3db1
...
...
@@ -11,7 +11,7 @@ for i=5:length(X)
end
if
length
(
X
)
>
3
infecter
=
sum
(
X
(
4
:
length
(
X
))
+
I
);
%
infecter = sum(X(4:length(X)) + I);
infection
=
S
*
(
1
-
25
*
options
.
InfectionRate
/
N
)
^
I
;
% infection = options.InfectionRate * S * infecter/N;
new_waiting
(
1
)
=
infection
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment