<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
span.E-MailFormatvorlage19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.nb
        {mso-style-name:nb;}
span.p
        {mso-style-name:p;}
span.n
        {mso-style-name:n;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi Daniel,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB">This shows that the wavelets are too long compared to your segment length at lower frequencies. Generally, you should thus choose segments that are long enough and thus contain enough data before the first time point
 of interest and after the last time point of interest. You can calculate the width of the wavelet for the lowest frequency of interest with the formula
</span><span class="nb"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Courier New"">width</span></span><span class="p"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Courier New"">/</span></span><span class="n"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Courier New"">F</span></span><span class="p"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Courier New"">/</span></span><span class="nb"><span lang="EN-GB" style="font-size:10.0pt;font-family:"Courier New"">pi</span></span><span lang="EN-GB">,
 where the width is the width of the wavelet and F is the frequency. You should add at least half the width of the wavelet to the data before the first data point of interest.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Best,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Christine<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">PS: Although there are probably other opinions, for analyses between 1 and 20Hz I usually choose a width of 3 as you did here too.  <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="mso-fareast-language:DE">Von:</span></b><span style="mso-fareast-language:DE"> fieldtrip <fieldtrip-bounces@science.ru.nl>
<b>Im Auftrag von </b>daniel.strahnen@uni-ulm.de<br>
<b>Gesendet:</b> Dienstag, 18. August 2020 19:12<br>
<b>An:</b> 'FieldTrip discussion list' <fieldtrip@science.ru.nl><br>
<b>Betreff:</b> [FieldTrip] Time-frequency analysis with Morlet wavelets<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Dear FieldTrip-Community,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB">I am trying to implement the time-frequency analysis tutorial onto my own data, however I am encountering the edge effects in the figure below.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">In general the results seem plausible since I would expect the prominent 5-10Hz power.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">The sampling rate of my data is 1kHz and it contains 30 trials with a length of 3s each.<o:p></o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-GB">The code I used is posted below. Does anyone have an idea on how to get a good spectrogram in the time edges in the beginning and in the end of the trials?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">        cfg              = [];<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">        cfg.output       = 'pow';<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">        cfg.channel      = 'all';<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">        cfg.method       = 'wavelet';<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">        cfg.foi          = 1:1:48;                       
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">        cfg.t_ftimwin    = 20./cfg.foi; <o:p>
</o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">        cfg.toi          = 1:0.001:4;                    
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">        cfg.width      = 3;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">        freq_data = ft_freqanalysis(cfg, data);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><img width="467" height="361" style="width:4.8645in;height:3.7604in" id="Grafik_x0020_1" src="cid:image003.jpg@01D675A3.59FE37C0" alt="Ein Bild, das Computer enthält.

Automatisch generierte Beschreibung"></span><span lang="EN-GB"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Thank you very much and best regards<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Daniel<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
</div>
</body>
</html>