query on coherence analysis

Muthuraman Muthuraman muthuraman10 at HOTMAIL.COM
Thu Jun 15 15:59:54 CEST 2006


Hello

Thankyou for the previous help it works now
i am able to proceed further to calculate the coherence

The problem now the coherence obtained using the mtmwelch
when i plot the coherence figures for the channels
all the coherence figures for the different channel looks the same
is there is a bug in how i am calculating the coherence

These are the steps i carried out in calculating the coherence

headerfile='pd_mof_tr0_c_0306.cnt';
hdr = read_fcdc_header(headerfile);
cfg.trl = [];
for i=1:floor(hdr.nSamples/hdr.Fs)
  cfg.trl(i,1) = (i-1)*hdr.Fs + 1;
  cfg.trl(i,2) = (i  )*hdr.Fs;
  cfg.trl(i,3) = 0;
end

cfg.headerfile=headerfile;
>>cfg.datafile=headerfile;
>>[data] = preprocessing(cfg);

-and after the data is preprocessed i change the channel labels from actual
cz to eeg26 and so on



cfg=[];
cfg.output='powandcsd';
cfg.method='mtmwelch';
cfg.foi=1:2:30;
numfoi = length(cfg.foi);
cfg.taper='hanning';
cfg.t_ftimwin=zeros(1,numfoi);
cfg.t_ftimwin(:)=0.5;
cfg.channel=channelselection({'EEG' 'EMG2'},data.label);
cfg.channelcmb={'EEG' 'EMG2'};
freq=freqanalysis(cfg,data);


-when i calculate using freqanalysis i get these warnings

1.000 Hz : WARNING - using only one taper for specified smoothing
Warning: Size vector should be a row vector with integer elements.
>In freqanalysis_mtmconvol at 360
  In freqanalysis at 182
  In freqanalysis_mtmwelch at 67
  In freqanalysis at 182
and so on till 30.000 hz

-and while processing

processing trial 2: 1000 samples
Warning: Size vector should be a row vector with integer elements.
>In freqanalysis_mtmconvol at 398
  In freqanalysis at 182
  In freqanalysis_mtmwelch at 67
  In freqanalysis at 182



fd=freqdescriptives([],freq);


cfg=[];
cfg.xparam='freq';
cfg.yparam='cohspctrm';
cfg.xlim=[3 30];
cfg.cohrefchannel='EMG2';
cfg.box='yes';
cfg.showlabels='yes';

cfg.channelname='EEG27';
singleplotER(cfg,fd);
-when i try to plot i get this error
??? Error using ==> char
Cell elements must be character arrays.

Error in ==> singleplotER at 326
  t=[char(cfg.channelname) ' / ' num2str(cfg.channelindex) ];


please , look at it and help me in this regard

thanking you
with regards
muthuraman

>From: Ingrid Nieuwenhuis <ingrid.nieuwenhuis at FCDONDERS.RU.NL>
>Reply-To: FieldTrip discussion list <FIELDTRIP at NIC.SURFNET.NL>
>To: FIELDTRIP at NIC.SURFNET.NL
>Subject: Re: [FIELDTRIP] query on coherence analysis
>Date: Tue, 6 Jun 2006 13:33:28 +0200
>
>Dear Muthuraman,
>
>cfg.xparam should not be 'foi', but 'freq' (see help singleplotER)
>
>Bests,
>Ingrid
>
>
>-----Original Message-----
>From: FieldTrip discussion list [mailto:FIELDTRIP at NIC.SURFNET.NL] On Behalf
>Of Muthuraman Muthuraman
>Sent: Tuesday, June 06, 2006 11:20 AM
>To: FIELDTRIP at NIC.SURFNET.NL
>Subject: Re: [FIELDTRIP] query on coherence analysis
>
>Hello
>
>Thanks for the comments, i have downloaded the latest version
>and now i am able to calculate using mtmwelch
>
>but i get a error when i am plotting
>i will included the matlab commands
>
> >>cfg=[];
>cfg.output='powandcsd';
>cfg.method='mtmwelch';
>cfg.foi=1:2:30;
>numfoi = length(cfg.foi);
>cfg.taper='hanning';
>cfg.t_ftimwin=zeros(1,numfoi);
>cfg.t_ftimwin(:)=0.5;
>cfg.channel=channelselection({'EEG' 'EMG2'},data.label);
>cfg.channelcmb={'EEG' 'EMG2'};
>freq=freqanalysis(cfg,data);
>
> >>fd=freqdescriptives([],freq);
>
>cfg=[];
>cfg.xparam='foi';
>cfg.yparam='cohspctrm';
>cfg.xlim=[0 30];
>cfg.cohrefchannel='EMG2';
>cfg.box='yes';
>cfg.showlabels='yes';
>cfg.channelname='EEG26';
>singleplotER(cfg,fd);
>
>??? Reference to non-existent field 'foi'.
>
>Error in ==> singleplotER at 272
>   plot(varargin{k-1}.(cfg.xparam), P, style);
>
>with regards
>muthu
>
>
> >From: Robert Oostenveld <r.oostenveld at FCDONDERS.RU.NL>
> >Reply-To: FieldTrip discussion list <FIELDTRIP at NIC.SURFNET.NL>
> >To: FIELDTRIP at NIC.SURFNET.NL
> >Subject: Re: [FIELDTRIP] query on coherence source analysis
> >Date: Thu, 1 Jun 2006 13:58:48 +0200
> >
> >Dear Muthuraman
> >
> >I have not been able to reproduce your error. I suggest that you get  the
> >latest version of FieldTrip from our FTP server and try again.
> >
> >best egards,
> >Robert
> >
> >PS this is the test script I used. It uses some simulated data, which
> >again uses a MEG gradiometer definition and a head model from the
>tutorial
>
> >data.
> >
> >
> >-----------------
> >% read some data that is required to simulate MEG data, i.e. volume
>model,
> >% sensor positions and MRI (optional, only for plotting)
> >vol  = read_ctf_hdm('Subject01.hdm');
> >hdr  = read_fcdc_header('Subject01.ds/Subject01.res4');
> >grad = hdr.grad;
> >
> >% construct the simulated MEG data for condition A ("active")
> >cfg               = [];
> >cfg.vol           = vol;
> >cfg.grad          = grad;
> >cfg.fsample       = 300;
> >cfg.ntrials       = 2;
> >cfg.triallength   = 1;
> >cfg.dip.pos       = [0 7 8];
> >cfg.dip.mom       = [1 0 0];
> >cfg.dip.signal    = sin(2*pi*10*(1:cfg.fsample)./cfg.fsample);
> >cfg.absnoise      = 1e-8;
> >data = dipolesimulation(cfg);
> >
> >% add the source signal as fake EMG channel
> >for i=1:cfg.ntrials
> >   data.trial{i}(end+1,:) = cfg.dip.signal + randn(size
>(cfg.dip.signal));
> >end
> >data.label{end+1} = 'EMG';
> >
> >cfg=[];
> >cfg.output='powandcsd';
> >cfg.method='mtmwelch';
> >cfg.foi=1:2:30;
> >numfoi = length(cfg.foi);
> >cfg.taper='hanning';
> >cfg.t_ftimwin=zeros(1,numfoi);
> >cfg.t_ftimwin(:)=0.5;
> >cfg.channel=channelselection({'MEG' 'EMG'},data.label);
> >cfg.channelcmb={'MEG' 'EMG'};
> >freq=freqanalysis(cfg,data);
> >
> >
> >



More information about the fieldtrip mailing list