/
mrcalculate.m
43 lines (34 loc) · 1.02 KB
/
mrcalculate.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
function [Rvalue,Ravg]=mrcalculate(linear_S,Nneur,Ntime)
%% Computing synchrony value across time
% Arguments
%linear_S: Spike times (linear_S=[times,number ID])
%Nneur: Number of neurons
%Ntime: Simulation time
% Output
%Rvalue: Synchrony value across time
%Ravg: Average synchrony value
% References
%Pinsky PF, Rinzel J (1995) Synchrony measures for biological neural networks. Biol Cybern 73:129–137.
%%
%Created on 2016
%@author: Vignayanandam R. Muddapu (CNS@IIT-Madras)
%%
Rvalue=[];phi=[];
phi=3000*ones(Nneur,Ntime-1);
for neur=1:Nneur
temptime=linear_S((linear_S(:,2)==neur));
% temptime =[4 12 21 30 60 78 100 117 126 163 503 652 797 857 940 943];
j=1;
while j<numel(temptime)
for i=temptime(j):1:temptime(j+1)-1
phi(neur,i)=(2*pi*(i-temptime(j)))/(temptime(j+1)-temptime(j));
end
j=j+1;
end
end
a=sqrt(-1);
tempM=sum(phi)/numel(phi);
M=exp(a*tempM);
Rvalue=((sum(exp(a*phi))/neur))./M;
Ravg=sum(abs(Rvalue))/numel(Rvalue);
end