cross-spectrum to cross-correlogram

jan-mathijs schoffelen j.schoffelen at PSY.GLA.AC.UK
Fri Oct 3 22:11:49 CEST 2008


Dear Jasper,

I did not yet completely think it through, but I see two problems
here. Obviously, you would like to verify whether multiplication in
the frequency domain is equivalent to convolution in the time
domain ;o),
actually that conjugate multiplication is equivalent to cross-
covariancing (shouldn't you use xcov, instead of xcorr?)

1 you apply a hanning taper in your frequency analysis; to make a
fair comparison you probably should specify cfg.taper='rectwin',
because your time domain data is not tapered in the xcorr-analysis
2 mathematically the convolution vs. multiplication holds when you
also take into account the 'negative frequencies' in your ifft.
However, freqanalysis does not output these in the first place
3 (sorry there's a third thing): probably you should specify the
additional option 'unbiased' when calling xcorr (or xcov), because
fft assumes circular data so the ifft'ed csd does not taper off at
the edges (which in the xcov/xcorr is due to a decrease in the number
of overlapping samples).

Hopefully these thoughts help.

Yours,

Jan-Mathijs



On Sep 29, 2008, at 8:54 AM, Jasper Poort wrote:

> CS=freq.fourierspctrm(:,1,:).*conj(freq.fourierspctrm(:,2,:));
> y = real((squeeze(mean(CS))));
> figure;plot(y)
>
> % inverse fft of cross-spectrum
> y = real(ifft(squeeze(mean(CS))));
> figure;plot(y)
>
> % compare to cross-correlation function
> [c,lags] = xcorr(mean(squeeze(wav(:,:,1)),2),mean(squeeze(wav(:,:,
> 2)),2));
> figure;plot(lags,c)


----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/fcdonders/fieldtrip.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20081003/8fcd2f96/attachment-0001.html>


More information about the fieldtrip mailing list