Home > eeg > egis > net_utils > eeg_2dfwsm.m

eeg_2dfwsm

PURPOSE ^

SYNOPSIS ^

function [fwsm_mat] = eeg_2dfwsm(csdm_data,good_chan,freq,k_range);

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [fwsm_mat] = eeg_2dfwsm(csdm_data,good_chan,freq,k_range);
0002 
0003 ch_pair_indices
0004 
0005 fwsm_mat = zeros(size(k_range,2),size(k_range,2));
0006 NChan = 129;
0007 %for if = 1:size(freqs,2)
0008 
0009 csdm_mat = zeros(129,129);
0010 csdm = zeros(size(good_chan,2),size(good_chan,2));
0011 for ichan =1:NChan
0012     for jchan = ichan:NChan;
0013         csdm_mat(ichan,jchan) = csdm_data(freq,chpair(ichan,jchan));
0014         csdm_mat(jchan,ichan) = conj(csdm_mat(ichan,jchan));
0015     end;    
0016 end;
0017 
0018 csdm = csdm_mat(good_chan,good_chan);
0019 [x,y,z] = electrodes(129);
0020 elec = xyz2tp(x,y,z);
0021 cchan_pos(:,1) = 9.2*elec(:,1);
0022 cchan_pos(:,2) = 9.2*elec(:,2);
0023 chan_pos = cchan_pos(good_chan,:);
0024 for c = 1:size(k_range,2)
0025 for j = 1:size(k_range,2)
0026     kvec1 = exp(i*k_range(j)*(ones(size(good_chan,2),1)*chan_pos(:,2)'-chan_pos(:,2)*ones(1,size(good_chan,2))));
0027     kvec2 = exp(i*k_range(c)*(ones(size(good_chan,2),1)*chan_pos(:,1)'-chan_pos(:,1)*ones(1,size(good_chan,2))));
0028     kvec = kvec1.*kvec2;
0029 %    for k = 1:size(good_chan,2)
0030 %        for l = 1:size(good_chan,2)
0031 %            kvec(k,l) = exp(i*k_range(j)*(chan_pos(l,2)-chan_pos(k,2)))*exp(i*k_range(c)*(chan_pos(l,1)-chan_pos(k,1)));
0032 %
0033 %    end;
0034 %    end;
0035 
0036     power = csdm.*kvec;
0037     fwsm_mat(c,j) = real(sum(sum(power))/(size(good_chan,2).^2));
0038 end;
0039 end;
0040 
0041 
0042 
0043 
0044 
0045 
0046

Generated on Sat 24-Aug-2019 04:00:39 by m2html © 2003