<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div>Dear Jasper,</div><div><br></div><div>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),</div><div>actually that conjugate multiplication is equivalent to cross-covariancing (shouldn't you use xcov, instead of xcorr?)</div><div><br></div><div>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</div><div>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</div><div>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).</div><div><br></div><div>Hopefully these thoughts help.</div><div><br></div><div>Yours,</div><div><br></div><div>Jan-Mathijs</div><div><br></div><div><br></div><br><div><div>On Sep 29, 2008, at 8:54 AM, Jasper Poort wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-GB" style="font-size: 10pt; font-family: Arial; ">CS=freq.fourierspctrm(:,1,:).*conj(freq.fourierspctrm(:,2,:));<o:p></o:p></span></font></p><p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-GB" style="font-size: 10pt; font-family: Arial; ">y = real((squeeze(mean(CS))));<o:p></o:p></span></font></p><p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-GB" style="font-size: 10pt; font-family: Arial; ">figure;plot(y)<o:p></o:p></span></font></p><p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-GB" style="font-size: 10pt; font-family: Arial; "><o:p> </o:p></span></font></p><p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-GB" style="font-size: 10pt; font-family: Arial; ">% inverse fft of cross-spectrum<o:p></o:p></span></font></p><p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-GB" style="font-size: 10pt; font-family: Arial; ">y = real(ifft(squeeze(mean(CS))));<o:p></o:p></span></font></p><p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-GB" style="font-size: 10pt; font-family: Arial; ">figure;plot(y)<o:p></o:p></span></font></p><p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-GB" style="font-size: 10pt; font-family: Arial; "><o:p> </o:p></span></font></p><p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-GB" style="font-size: 10pt; font-family: Arial; ">% compare to cross-correlation function<o:p></o:p></span></font></p><p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-GB" style="font-size: 10pt; font-family: Arial; ">[c,lags] = xcorr(mean(squeeze(wav(:,:,1)),2),mean(squeeze(wav(:,:,2)),2));   <o:p></o:p></span></font></p><p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-left: 0cm; margin-bottom: 0.0001pt; font-size: 12pt; font-family: 'Times New Roman'; "><font size="2" face="Arial"><span lang="EN-GB" style="font-size: 10pt; font-family: Arial; ">figure;plot(lags,c)</span></font></p></span></blockquote></div><br></body></html><p>----------------------------------</p>
<p>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.</p>
<p>  http://listserv.surfnet.nl/archives/fieldtrip.html</p>
<p>  http://www.ru.nl/fcdonders/fieldtrip/</p>