-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPhaseODE_IFAC2020.m
More file actions
75 lines (39 loc) · 1.42 KB
/
Copy pathPhaseODE_IFAC2020.m
File metadata and controls
75 lines (39 loc) · 1.42 KB
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
73
74
75
%% PhaseODE_IFAC2020.m
%%% MARCH 10, 2020
clear all
close all
%% Set number of cells N
N = 50; % Minimum N = 2.
%% Set network topology
net_top = 'All-to-All'; % net_top = 'All-to-All' | 'Ring' | 'Star-like'
%%
[x0, L] = PhaseODE_initSIM(N, net_top);
D = 1; % Diffusion rate
kappa = .3; %
h = +Inf; % Hill's Coefficient.
%% Set simulation time and tSPAN
t_i = 0; % initial simulation time (min)
t_f = 4000; %final simulation time (min)
tSPAN = [t_i t_f];
%% Set variables and options for odesolver
options = odeset('RelTol', 1e-03, 'AbsTol', 1e-04, 'MaxStep', 1e-01);
%% Simulate the population of N(t) oscillators
tic
[t_out, x_out] = ode23t(@PhaseODE_NonCycling, tSPAN, x0, options, N, L, D, kappa, h);
toc
%% Retrieve the cells' phase Theta and the cells' Volume
Theta = mod(x_out(:,1:4:end), 2*pi);
%% Compute the mean phase coherence R
R = nan(length(t_out),1);
Psi = nan(length(t_out),1);
for z = 1:length(t_out)
tempTheta = Theta(z,~isnan(Theta(z,:))); % Consider only those cells that exist at time t_out(z).
tempN = numel(tempTheta); % Number of cells at time t_out(z).
KOP = 1 ./ tempN .* sum(exp(1i .* tempTheta));
R(z) = abs(KOP);
Psi(z) = angle(KOP);
end
%% Compute the performance index J
J = 1 / (t_f - t_i) .* trapz(t_out, R);
%% Plot cells' phase
makeFIG(t_out, x_out, net_top, N, h)