cross spectral density issues

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Mon Mar 19 21:58:57 CET 2007

Hi Sameer,

On 19 Mar 2007, at 14:26, Sameer Walawalkar wrote:
> When I do
> cfgCSD            = [];
> cfgCSD.output     = 'powandcsd';
> cfgCSD.method     =  'mtmfft';
> cfgCSD.foilim     = [5 100];
> cfgCSD.tapsmofrq  = 5;
> cfgCSD.keeptrials = 'yes';
>    = {'MEG'} ;
> cfgCSD.channelcmb = {'MEG' 'MEG'};
> freqCSD_RR_One    = freqanalysis(cfgCSD,dataRR_One);
> I get the following error.
> ??? Error using ==> unknown
> Maximum variable size allowed by the program is exceeded.
> Error in ==> freqanalysis_mtmfft at 342
>     if csdflg, crsspctrm     = complex(zeros
> (numper,numsgncmb,numboi)); end

How large is the matrix that you are trying to allocate? I.e. how
large is Ntrials times (Nchans^2)/2 times the number of frequency
bins? The number of frequency bins depends on the data, specifically
on the length of your trials. For 1-sec trials, you have one
frequency bin per Herz, for 2-sec trials you have two, etc.

The total amount of memory is the number of elements in the matrix
times 16 bytes (since each matrix element has a double precision real
and imaginary number).

> Error in ==> freqanalysis at 167
> [freq] = feval(sprintf('freqanalysis_%s',lower(cfg.method)), cfg,
> data);
> But I remember using something very close to this some ten days
> ago. So I am not sure what I might be doing wrong. Any suggestions
> are very welcome.

You may have used fewer frequency bins (cfg.foilim) or the data may
have had fewer trials.

> I tried using method 'mtmwelch' but that gave a host of other
> errors including looking for cfg.foi instead of cfg.foilim (non
> uniformity in application).

Please look at the documentation in FREQANALYSIS_MTMWELCH. I suspect
that the mtmwelch method will require even more memory.

Are you sure with the amount of data that you have that you want to
keep trials?


More information about the fieldtrip mailing list