Home > eeg > egis > petr_dirtier > coh_from_csdm.m

coh_from_csdm

PURPOSE ^

cohmat = coh_from_csdm(csdmdata)

SYNOPSIS ^

function cohmat = coh_from_csdm(csdmdata)

DESCRIPTION ^

  cohmat = coh_from_csdm(csdmdata)

  csdmdata, dim 1 = freqbands
  csdmdata, dim 2 = crossed chans
  csdmdata, dim 3 (optional) = cells

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function cohmat = coh_from_csdm(csdmdata)
0002 %  cohmat = coh_from_csdm(csdmdata)
0003 %
0004 %  csdmdata, dim 1 = freqbands
0005 %  csdmdata, dim 2 = crossed chans
0006 %  csdmdata, dim 3 (optional) = cells
0007 
0008 % 01/30/00 PJ
0009 
0010 nfreq = size(csdmdata, 1);
0011 
0012 if (size(csdmdata,2) ~= (129^2 + 129)/2)
0013   error('Not equiped to handle non 129 channel data')
0014 end
0015 
0016 ch_pair_indices
0017 power_indices = diag(chpair);
0018 
0019 lower_indices = find(tril(ones(129)));
0020 
0021 cohmat = zeros(size(csdmdata));
0022 
0023 ncells = size(csdmdata,3);
0024 
0025 for icell = 1:ncells
0026   for ifreq = 1:nfreq
0027     datavect = csdmdata(ifreq,:,icell);
0028     powervect = csdmdata(ifreq,power_indices,icell);
0029     
0030     cross_power = powervect' * powervect;
0031     
0032     cohmat(ifreq,:,icell) = (datavect .* conj(datavect))./cross_power(lower_indices)';
0033   end
0034 end

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003