-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSC_MFM.m
46 lines (33 loc) · 1.12 KB
/
SC_MFM.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
function SC = SC_MFM(FC)
% ----------------------------------------------------------------------- %
% <<<<<<<<<<<<< code for non-linear FC-to-SC completion >>>>>>>>>>>>>>>>> %
% ----------------------------------------------------------------------- %
% -> This function takes as input the empirical functional connectivity FC
% and simulate the MFM structure connectivity SC
% -> input: TS --> empirical time-series
% -> output: SC --> non-linear virtual SC (SC_MFM)
rng('shuffle')
n = size(FC,2); % determine the number of regions
FCemp = FC/max(max(FC)); % normalize empirical input FC
% build SC_0: intial random matrix
sc0 = randn(n);
sc0 = sc0-sc0.*eye(n);
sc0 = abs(sc0);
sc0 = (sc0+sc0')/2;
sc0 = sc0/max(max(sc0));
% train the sc0
for iter=1:1000
FCsim = FC_MFM(sc0);
FCsim = FCsim/max(max(FCsim));
D = FCemp-FCsim;
cc = corrcoef(FCemp,FCsim)
sc0 = sc0+0.001.*D;
sc0(sc0<0) = 0;
sc0 = (sc0+sc0')/2;
sc0 = sc0/max(max(sc0));
if cc(2) > .5
SC = sc0; % return SC_MFM as output
break
end
end
end