-
Notifications
You must be signed in to change notification settings - Fork 1
/
SingleSimulationModel.m
60 lines (49 loc) · 1.55 KB
/
SingleSimulationModel.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
% simulate using artificial matrices
%% init
% clear workspace
clearvars();
% paths
addpath(genpath('./Helper Functions/'));
addpath(genpath('./BCT/'));
% load settings
settings = Settings();
% focal or diffuse injury
settings.focal = false;
% distance matrix
Dist = DistMatrix(settings.N);
%% single simulation
[C_t, E_t, L_s] = NMM(settings, Dist, true);
C = squeeze(C_t(settings.steps, :, :));
HeatMap(C);
%% save excitation through time
% csvwrite('./R/Results/simulation/E_t.csv', E_t);
%% simulation plot
%M_t = MetricsThroughTime(C_t);
%csvwrite('./R/Results/simulation/M_t_model.csv', M_t);
%% three matrices collage
% C_h = squeeze(C_t(settings.steps / 2, :, :));
% C_i = squeeze(C_t((settings.steps / 2) + 1, :, :));
% csvwrite('./R/Results/matrices/C_h.csv', C_h);
% csvwrite('./R/Results/matrices/C_i.csv', C_i);
% csvwrite('./R/Results/matrices/L_s.csv', L_s);
%% stability plot
% duration = 2000;
% con = C_t(settings.steps - duration + 1 : settings.steps, 1, 10);
% csvwrite('./R/Results/stability/model.csv', con);
%% power spectrum
% most injured node
% L_n = sum(L_s);
% [~, ix] = max(L_n);
%
% duration = 50000;
% pre = (settings.steps / 2 - duration + 1 : settings.steps / 2);
% post = (settings.steps / 2 + 1 : settings.steps / 2 + duration);
%
% Fs = 700;
% [preF, preP] = PowerSpectrum(E_t(ix, pre), Fs);
% [postF, postP] = PowerSpectrum(E_t(ix, post), Fs);
% PS_most_pre = [preF; preP'];
% PS_most_post = [postF; postP'];
%
% csvwrite('./R/Results/injury/PS_model_pre.csv', PS_most_pre);
% csvwrite('./R/Results/injury/PS_model_post.csv', PS_most_post);