<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- P { margin-top: 0px; margin-bottom: 0px; } p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Dear Fieldtrippers,<br>
</p>
<p>My name is Ketan Jaltare, and I am a PhD scholar at KU Leuven. I have been studying the impact of the social context on markers of chronic pain. I am fairly new to time frequency analysis with Fieldtrip and dont really know if im doing the right things for
 a Time Frequency analysis on some epoched EEG data.<br>
</p>
<p><br>
</p>
<p>I have 3 second Epochs and I am interested in frequencies between 1 to 5Hz (although I want to compute the TF representation for up to 30 Hz). After a lot of trial and error, I finally arrived at the following parameters for mtmconvol with a single taper,
 but this way I am losing ~250ms of data on each end of the 3 second epoch (see figure):<br>
</p>
<p><br>
</p>
<div class="rtcContent" style="padding: 30px;">
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg = [];</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.output = <span style="color: rgb(170, 4, 249);">
'pow'</span>;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.channel = <span style="color: rgb(170, 4, 249);">
'all'</span>;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.method = <span style="color: rgb(170, 4, 249);">
'mtmconvol'</span>;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.taper = <span style="color: rgb(170, 4, 249);">
'hanning'</span>;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.toi = -1 : 0.01 : 2;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.foi = 1:30;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.pad = 10;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.t_ftimwin = ones(size(cfg.foi))*.5;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">dataout = ft_freqanalysis(cfg, datain);</span></div>
<div class="lineNode">
<div class="rtcContent" style="padding: 30px;">
<div class="lineNode" style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px;">
<span style="white-space: pre;"><span style="color: rgb(2, 128, 9);">% Now plot the data at Cz</span></span></div>
<div class="lineNode" style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px;">
<span style="white-space: pre;">cfg = [];</span></div>
<div class="lineNode" style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px;">
<span style="white-space: pre;">cfg.baseline = [-.5 -.2];</span></div>
<div class="lineNode" style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px;">
<span style="white-space: pre;">cfg.baselinetype = <span style="color: rgb(170, 4, 249);">
'absolute'</span>;</span></div>
<div class="lineNode" style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px;">
<span style="white-space: pre;"><span style="color: rgb(2, 128, 9);">%cfg.zlim = [0 2];</span></span></div>
<div class="lineNode" style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px;">
<span style="white-space: pre;">cfg.channel = <span style="color: rgb(170, 4, 249);">
'E129'</span>;</span></div>
<div class="lineNode" style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px;">
<span style="white-space: pre;">cfg.layout = <span style="color: rgb(170, 4, 249);">
'GSN-HydroCel-129.mat'</span>;</span></div>
<div class="lineNode" style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px;">
<span style="white-space: pre;">figure</span></div>
<div class="lineNode"><font face="Menlo, Monaco, Consolas, Courier New, monospace" size="2"><span style="white-space: pre;">ft_singleplotTFR(cfg, data out);</span></font><span style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; white-space: pre;">​</span><br>
</div>
<div class="lineNode" style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px;">
<br>
</div>
</div>
</div>
</div>
<p>I have also tried wavelet convolution, but there again I am losing data at the low frequencies (I think due to the length of the wavelets required to capture these low frequencies). Here is the code I used for wavelet convolution: <br>
</p>
<p><br>
</p>
<div class="rtcContent" style="padding: 30px;">
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">    cfg = [];</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.output = <span style="color: rgb(170, 4, 249);">
'pow'</span>;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.channel = <span style="color: rgb(170, 4, 249);">
'E129'</span>;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.method = <span style="color: rgb(170, 4, 249);">
'wavelet'</span>;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.toi = -1 : 0.01 : 2;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.foi = 1:30;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.width = linspace(1.5,.3,length(cfg.foi));</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;"><span style="color: rgb(2, 128, 9);">%cfg.gwidth = linspace(2,.3,length(cfg.foi));</span></span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.pad = 5;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">T0Conttfr = ft_freqanalysis(cfg, T0Cont);</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg = [];</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.baseline = [-.5 -.2];</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.baselinetype = <span style="color: rgb(170, 4, 249);">
'absolute'</span>;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.maskstyle = <span style="color: rgb(170, 4, 249);">
'saturation'</span>;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.channel = <span style="color: rgb(170, 4, 249);">
'E129'</span>;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">cfg.layout = <span style="color: rgb(170, 4, 249);">
'GSN-HydroCel-129.mat'</span>;</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">figure</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<span style="white-space: pre;">ft_singleplotTFR(cfg, T0Conttfr);</span></div>
<div class="lineNode" style="font-size: 13px; font-family: Menlo, Monaco, Consolas, "Courier New", monospace;">
<br>
</div>
</div>
<p>With wavelet convolution, I am also getting a lot of smoothing/stretching in the frequency domain at  frequencies above ~3 Hz and Im not sure what the right parameters are to avoid this. <br>
</p>
<p><br>
</p>
<p>I have also attached example figures from both implementations (MTM and Wavelet convolution) for your reference. <br>
</p>
<p><br>
</p>
<p>Here are my questions:<br>
</p>
<p>1) Is there any way to avoid the loss of the data at the edges with mtmconvol? Also, do the parameters that I have used seem to be okay for what I am trying to do?<br>
</p>
<p><br>
</p>
<p>2) With wavelet convolution, is it just that my epochs are not long enough to get at these low frequencies? Or am I getting the parameters wrong? <span style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px; background-color:rgb(255,255,255)">Any
 help would be greatly appreciated.</span>​<br>
</p>
<p><br>
</p>
<p>3) How can I avoid the smearing that I am getting for the higher frequencies using wavelet convolution?<br>
</p>
<p><br>
</p>
<p>and finally,<br>
</p>
<p><br>
</p>
<p>4) At the moment, I am only doing the baseline normalisation when plotting the output of <span style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; white-space: pre; background-color: rgb(255, 255, 255);">ft_freqanalysis</span>.
 Is there any way to perform this baseline normalisation using <span style="font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 13px; white-space: pre; background-color: rgb(255, 255, 255);">ft_freqanalysis</span>​ itself?<br>
</p>
<p><br>
</p>
<p>Thank you in advance for your help!<br>
</p>
<p><br>
</p>
<p>Regards,<br>
</p>
<p><br>
</p>
<div id="Signature">
<div name="divtagdefaultwrapper" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:; margin:0">
<font size="2"><span lang="NL-BE" style="font-size:10pt; font-family:Arial,sans-serif; color:gray">Ketan Jaltare, M.Sc. | PhD Student</span><br>
<span lang="NL-BE" style="font-size:10pt; font-family:Arial,sans-serif; color:gray"></span></font><span lang="NL-BE" style="font-size:10pt; font-family:Arial,sans-serif; color:gray"><font size="2">Research Group Health Psychology</font></span><br style="font-size:16px">
<span lang="NL-BE" style="font-size:10pt; font-family:Arial,sans-serif; color:gray"></span><span style="font-size:16px; background-color:rgb(255,255,255)"></span>
<p class="MsoNormal" style="margin-bottom:7.5pt; font-size:16px"><span lang="NL-BE" style="font-size:10pt; font-family:Arial,sans-serif; color:gray"><font size="2">KU Leuven, Belgium</font></span></p>
</div>
</div>
</body>
</html>