Home > eeg > egis > meg_code > meg_coherence.m

meg_coherence

PURPOSE ^

SYNOPSIS ^

function avg_coherence = meg_coherence(ravgcsdm,iavgcsdm,bad_chan);

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function avg_coherence = meg_coherence(ravgcsdm,iavgcsdm,bad_chan);
0002 NChan = 148;
0003     mask = ones(1,NChan);
0004     mask(bad_chan) = zeros(1,size(bad_chan,2));
0005     good_chan = find(mask);
0006     chpair = channel_pairs(NChan);
0007     avg_coherence = zeros(size(ravgcsdm,1),size(ravgcsdm,2));
0008 
0009     for i = 1:size(good_chan,2)
0010     for j = i:size(good_chan,2)
0011         avg_coherence(:,chpair(good_chan(i),good_chan(j)))= ((ravgcsdm(:,chpair(good_chan(i),good_chan(j))).^2)+(iavgcsdm(:,chpair(good_chan(i),good_chan(j))).^2))./ravgcsdm(:,chpair(good_chan(i),good_chan(i)))./ravgcsdm(:,chpair(good_chan(j),good_chan(j)));
0012     end;
0013 end;
0014 
0015     avg_coherence(find(isnan(avg_coherence))) = zeros(size(find(isnan(avg_coherence))));

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