66n = 268 ; % Full connectivity matrix for 268 ROIs (35,778 edges)
77img = zeros(n , n );
88
9- % Create random functional connectivity values between -1 and 1
10- % Fill the upper triangular part of the matrix with random FC values
9+ % Parameters for peak generation
10+ num_peaks = 8 ; % Number of functional network "hubs"
11+ peak_width = 15 ; % Width of Gaussian peaks (in ROI units)
12+ peak_strength = 0.99 ; % Maximum correlation strength
13+ background_noise = 0.15 ; % Background connectivity noise level
14+
15+ % Generate random peak centers (representing functional network hubs)
16+ rng(20 ); % Set seed for reproducibility
17+ peak_centers = randi([1 , n ], num_peaks , 2 );
18+
19+ % Create the connectivity matrix
1120for i = 1 : n
1221 for j = (i + 1 ): n
13- img(i ,j ) = (rand() * 2 ) - 1 ; % Random value between -1 and 1
22+ % Start with Gaussian background noise
23+ value = randn() * background_noise ;
24+
25+ % Add Gaussian peaks centered at network hubs
26+ for p = 1 : num_peaks
27+ % Distance from this edge to the peak center
28+ dist_i = min(abs(i - peak_centers(p , 1 )), abs(i - peak_centers(p , 2 )));
29+ dist_j = min(abs(j - peak_centers(p , 1 )), abs(j - peak_centers(p , 2 )));
30+ dist = sqrt(dist_i ^ 2 + dist_j ^ 2 );
31+
32+ % Add Gaussian contribution from this peak
33+ value = value + peak_strength * exp(-dist ^ 2 / (2 * peak_width ^ 2 ));
34+ end
35+
36+ % Add some distance-dependent decay (closer ROIs more correlated)
37+ distance_factor = exp(-abs(i - j ) / 100 );
38+ value = value + 0.2 * distance_factor * randn();
39+
40+ img(i , j ) = value ;
1441 end
1542end
1643
17-
1844% Make it symmetric
1945img = img + img ' ;
2046
87113title(' Absolute Difference' , ' FontSize' , 18 , ' FontWeight' , ' bold' );
88114colormap(gca , ' redblue' );
89115colorbar(' FontSize' , 12 );
116+ tfce_max = max([max(tfced1(: )), max(tfced2(: ))]);
117+ caxis([0 , 1 ]);
90118set(gca , ' FontSize' , 14 );
91119xlabel(' ROI' , ' FontSize' , 14 );
92- ylabel(' ROI' , ' FontSize' , 14 );
120+ ylabel(' ROI' , ' FontSize' , 14 );
121+
0 commit comments