Main Data History
Show Index Toggle 0 comments
  •  Quick Edit
  • Homework 6

    Real vs. spurious interactions

    We located the peaks in the spectral estimation and then visualized the coherences at different frequencies and locations using the following Matlab code:

    clear close all load P1_connectivity_data.mat [spectra, f] = pwelch(funct_data', [], [], 2^nextpow2(4*sff), sff); d = diff(f); n = round(2/d(1)); win = hamming(n); win = win/sum(win); f30 = f(f<30); % Find peak locations [~, inds] = sort(max(spectra, [], 1)); inds = inds(end-1:end); %% figure spectra1_2Hz = conv(spectra(:,inds(1)),win,'same'); spectra15_2Hz = conv(spectra(:,14),win,'same'); semilogy(f30, spectra1_2Hz(f<30), 'linewidth', 2 ) hold on semilogy(f30, spectra15_2Hz(f<30), 'linewidth', 2 ) xlabel('frequency [Hz]'); ylabel('Spectral density'); legend('Appropriate reference','Inappropriate reference', 'Location', 'Best'); Cxy = zeros(2,1025,29); [Cxy(1,:,:), f] = mscohere(funct_data(inds(1),:)', funct_data', [], [], 2^nextpow2(4*sff), sff); [Cxy(2,:,:), f] = mscohere(funct_data(14,:)', funct_data', [], [], 2^nextpow2(4*sff), sff); % Convolve with 2 Hz window Cxy2Hz = zeros(size(Cxy)); for i=1:2 for j=1:29 Cxy2Hz(i,:,j) = conv(Cxy(i,:,j), win, 'same'); end end Cxy30 = Cxy2Hz(:,f<30,:); %% figure; plot( locations, mean(squeeze(Cxy30(1,n:end,:)), 1), 'linewidth', 2 ); axis tight; hold on plot( locations, mean(squeeze(Cxy30(2,n:end,:)), 1), 'linewidth', 2 ); axis tight; xlabel('Distance'); ylabel('Coherence'); legend('Appropriate reference','Inappropriate reference', 'Location', 'Best'); % Plot magnitude squared coherence of the two source points figure; subplot(1,2,1); surf(locations, f30(n:4:end), squeeze(Cxy30(1,n:4:end,:)),'edgealpha',0.3, 'FaceColor','interp'); xlabel('location'); ylabel('frequency'); title('Appropriate reference') subplot(1,2,2); surf(locations, f30(n:4:end), squeeze(Cxy30(2,n:4:end,:)),'edgealpha', 0.3, 'FaceColor','interp'); xlabel('location'); ylabel('frequency'); title('Inappropriate reference')

    In Fig. \ref{spectra}, we show the spectral density of the signal at an activated and inactivated reference locations. The activated reference shows a peak at 12 Hz, whereas the other source location has a flat spectrum. The coherences between the two source locations and the other sources are plotted in Figs. \ref{means} and \ref{surfs}. It can be seen that the sources are maximally coherent with themselves, but the appropriate reference is also coherent with the other prominent source and mostly at 12 Hz.

    The field spread of the inactivated reference is very large compared to that of the activated reference. It can also be noted that coherences between the inactivated reference the activated locations are close to zero.

    Spectral density of the estimated signal at two reference locations. \label{spectra}