-
Notifications
You must be signed in to change notification settings - Fork 1
/
BifurcationDiagram.m
56 lines (42 loc) · 1.04 KB
/
BifurcationDiagram.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
% Bifurcation Diagram simulations
%% init
% clear workspace
clearvars();
% paths
addpath(genpath('./Helper Functions/'));
addpath(genpath('./BCT/'));
% load real or model settings
settings = Settings();
settings.steps = 20000;
% disable SDP, GDP
% !!! also set C = ones(N) in NMM
settings.a_sdp = 0;
settings.a_gdp = 0;
% mu
mu_m = 0; % min mu
mu_M = 7; % max mum
mu_s = 0.2; % mu step
% number of steps and iterations
muSteps = ceil((mu_M - mu_m) / mu_s) + 1;
% variables to store results
E = zeros(muSteps, settings.steps);
parameters = zeros(1, muSteps);
% index of iterations
ix = 1;
%% simulate
for mu = mu_m:mu_s:mu_M
% progress
disp(['Step: ', num2str(ix), '/', num2str(muSteps)])
% settings
settings.mu = mu;
% NMM simulation
[C_t, E_t, ~] = NMM(settings, false);
% store results
E(ix, :) = E_t(1, 1 : size(E_t, 2));
parameters(1, ix) = mu;
% increase index
ix = ix + 1;
end
%% save data
csvwrite('./R/Results/bifurcation/E_model.csv', E);
csvwrite('./R/Results/bifurcation/bifurcation_parameters.csv', parameters);