<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=iso-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<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;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.E-MailFormatvorlage17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1506551478;
        mso-list-type:hybrid;
        mso-list-template-ids:1841832364 -1526852590 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
        {mso-level-text:"%1\.\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l0:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l0:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1
        {mso-list-id:1760715807;
        mso-list-type:hybrid;
        mso-list-template-ids:1917369322 -819852224 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
        {mso-level-text:"%1\.\)";
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level2
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level3
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level4
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level5
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level6
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
@list l1:level7
        {mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level8
        {mso-level-number-format:alpha-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;}
@list l1:level9
        {mso-level-number-format:roman-lower;
        mso-level-tab-stop:none;
        mso-level-number-position:right;
        text-indent:-9.0pt;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></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="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi all,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I have a question about how FieldTrip normalizes the output of a spectral analyses using ft_freqanalysis.<o:p></o:p></p>
<p class="MsoNormal">This is important for me, because I need the absolute value of the spectrum for a publication.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I was scanning through the code trying to find the normalization steps.<o:p></o:p></p>
<p class="MsoNormal">In particular, I don’t understand the following steps:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l1 level1 lfo2"><![if !supportLists]><span style="mso-list:Ignore">1.)<span style="font:7.0pt "Times New Roman"">   
</span></span><![endif]>The tapers (e.g. hanning) are normalized prior to the multiplication with the data by the following code:<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:18.0pt;text-indent:18.0pt"><i>tap = tap./norm(tap, 'fro');
</i>  (line 195 in the function fr_specest_mtmfft)<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:18.0pt;text-indent:18.0pt">What is the rationale of dividing through this special norm of the taper itself?<o:p></o:p></p>
<p class="MsoNormal" style="margin-left:18.0pt;text-indent:18.0pt"><o:p> </o:p></p>
<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l1 level1 lfo2"><![if !supportLists]><span style="mso-list:Ignore">2.)<span style="font:7.0pt "Times New Roman"">   
</span></span><![endif]>After calculating the fft, the specrum is scaled (i.e. in the function fr_specest_mtmfft) by:<o:p></o:p></p>
<p class="MsoListParagraph"><i><span lang="DE">dum = dum .* sqrt(2 ./ endnsample);  (line 251)<o:p></o:p></span></i></p>
<p class="MsoListParagraph">Later on, to get to the power spectrum, the abs of the spectrum is taken and squared<o:p></o:p></p>
<p class="MsoListParagraph"><i>powdum = abs(spectrum(acttap,:,foiind(ifoi),acttboi)) .^2;</i> (line 629 in ft_frequanalysis)<o:p></o:p></p>
<p class="MsoListParagraph"><o:p> </o:p></p>
<p class="MsoListParagraph">This puzzles me, because scanning through the literature, the power spectrum should be given by<o:p></o:p></p>
<p class="MsoListParagraph"><span lang="DE">(2*abs(X)^2) ./ </span>(nfft^2)                -> unit: V^2        (X=signal, nfft = number of data points)<o:p></o:p></p>
<p class="MsoListParagraph">and the PSD by<o:p></o:p></p>
<p class="MsoListParagraph">(2*abs(X)^2) ./ (nfft*Fs)              -> unit: V^2/Hz (X=signal, nfft = number of data points, Fs=sampling rate)<o:p></o:p></p>
<p class="MsoListParagraph"><o:p> </o:p></p>
<p class="MsoListParagraph">Alternatively, one can get the amplitude spectrum from the power spectrum by taking the square root of the PSD:<o:p></o:p></p>
<p class="MsoListParagraph">sqrt(PSD)                             -> unit: V/sqrt(Hz)<o:p></o:p></p>
<p class="MsoListParagraph">which is still different from<o:p></o:p></p>
<p class="MsoListParagraph">(2*abs(X)) ./ (nfft*Fres)               -> unit: V/Hz ?   (Fres = frequency resolution = Fs/nfft)<o:p></o:p></p>
<p class="MsoListParagraph"><o:p> </o:p></p>
<p class="MsoListParagraph">The result of these equations are different from what comes out of the FieldTrip code.<o:p></o:p></p>
<p class="MsoListParagraph">So what is the unit of the spectrum in FieldTrip? <o:p>
</o:p></p>
<p class="MsoListParagraph">What is the rationale of scaling the complex spectrum by sqrt(2/nfft) ? 
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Furthermore, is the unit for the different spectral estimation methods the same? That is, using mtmfft, mtmconvol, wavelet,…?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It would help me a lot if someone could clarify these points.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks in advance,<o:p></o:p></p>
<p class="MsoNormal">Thomas<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:9.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt">-----<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt">Dr. Thomas Wunderle<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt"><a href="http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews"><span style="color:windowtext;text-decoration:none">Ernst Strüngmann Institute
</span><span lang="DE" style="color:windowtext;text-decoration:none">(ESI) for Neuroscience</span></a></span><span lang="DE" style="font-family:"Arial","sans-serif""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:9.0pt"><a href="http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews"><span style="color:windowtext;text-decoration:none">in Cooperation with Max Planck Society
</span></a></span><span style="font-size:9.0pt"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:9.0pt">Deutschordenstrasse 46</span><span lang="DE"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:9.0pt">60528 Frankfurt am Main, Germany</span><span lang="DE"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:9.0pt"><a href="http://www.esi-frankfurt.de/"><span style="color:blue">www.esi-frankfurt.de</span></a></span><span lang="DE"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:9.0pt"><a href="mailto:thomas.wunderle@esi-frankfurt.de"><span style="color:blue">thomas.wunderle@esi-frankfurt.de</span></a></span><span lang="DE"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:9.0pt">Tel:   +49 69 96769 516<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:9.0pt">Fax:   +49 69 96769 555<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:9.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:10.0pt;color:gray">Sitz der Gesellschaft: Frankfurt am Main<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:10.0pt;color:gray">Registergericht: Amtsgericht Frankfurt - HRB 84266<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE" style="font-size:10.0pt;color:gray">Geschäftsführer: Prof. Dr. Pascal Fries<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="DE"><o:p> </o:p></span></p>
</div>
</body>
</html>