-
Notifications
You must be signed in to change notification settings - Fork 0
/
cal_freq_amp.m
144 lines (101 loc) · 3.04 KB
/
cal_freq_amp.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
function cal_freq_amp(par_stst, tspan)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
global pE dE1 dE2 wE nE KE betaE
global pI dI1 dI2 wI nI KI
global JK JD tauK tauD
global N
global vK vD
global E10 I20 aI aE
%% Extract frequency and amplitude of oscillation
fprintf('----- Extract frequencies -----\n');
length_par = length(par_stst);
freq_list = [];
max_list = [];
min_list = [];
amp_list = [];
par_list = [];
T_list = [];
for i=1:5:length_par
dI1 = par_stst(i);
JK = vK*J(rhobulkK);
JD = vD*J(rhobulkD);
tauK = delay(rhobulkK, N, vK);
tauD = delay(rhobulkD, N, vD);
delays = [tauK, tauD];
sol = dde23(@rhs_dde23, delays, @history, tspan);
end
for i=1:5:length_par
fprintf(append(namepar,sprintf('=%g\n',par_stst(i))));
if nunst_stst(i)>0
switch namepar
case 'pE'
pE = par_stst(i);
case 'pI'
pI = par_stst(i);
case 'wE'
wE = par_stst(i);
case 'wI'
wI = par_stst(i);
case 'rhobulkK'
rhobulkK = par_stst(i);
case 'rhobulkD'
rhobulkD = par_stst(i);
case 'vK'
vK = par_stst(i);
case 'vD'
vD = par_stst(i);
case 'N'
N = par_stst(i);
case 'dE1'
dE1 = par_stst(i);
case 'dE2'
dE2 = par_stst(i);
case 'dI1'
dI1 = par_stst(i);
case 'dI2'
dI2 = par_stst(i);
end
JK = vK*J(rhobulkK);
JD = vD*J(rhobulkD);
tauK = delay(rhobulkK, N, vK);
tauD = delay(rhobulkD, N, vD);
delays = [tauK, tauD];
sol = dde23(@rhs_dde23, delays, @history, tspan);
[freq, amp, T, amp_max, amp_min] = extract_freq_amp(sol, no_y, t_start, t_end, dt);
if amp<1e-2
freq = 0;
end
par_list(end+1) = par_stst(i);
freq_list(end+1) = freq;
max_list(end+1) = amp_max;
min_list(end+1) = amp_min;
amp_list(end+1) = amp;
T_list(end+1) = T;
end
end
fig_freq=figure('Name','freq','NumberTitle','off');
plot(par_list, freq_list, 'b.');
xlabel(namepar);
ylabel('Frequency');
freq_max = max(freq_list);
freq_min = min(freq_list);
ylim([freq_min*0.8, freq_max*1.2]);
fig_period=figure('Name','Period','NumberTitle','off');
plot(par_list, T_list, 'b.');
xlabel(namepar);
ylabel('Period');
T_max = max(T_list);
T_min = min(T_list);
ylim([T_min*0.8, T_max*1.2]);
fig_amp=figure('Name','amp','NumberTitle','off');
plot(par_list, amp_list, 'b.');
xlabel(namepar);
ylabel('Amplitude');
figure(fig_bf);
ax1 = gca;
hold on;
plot(ax1,par_list,max_list,'k.', 'DisplayName','max');
plot(ax1,par_list,min_list,'r.', 'DisplayName','min');
legend(ax1,'location','best');
%%%%%%%%%%%%%%%%%%%%%%%%55
end