<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi Zhiwei,<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 4 Oct 2022, at 02:59, <a href="mailto:fewaster@gmail.com" class="">
fewaster@gmail.com</a> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="caret-color: rgb(0, 0, 0); font-family: "Segoe UI"; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span class=""></span>
<div class="">Thank you, Jan-Mathijs!</div>
<div class=""><br class="">
</div>
<div class="">I still have two questions:</div>
<div class="">1. about average bandpower.</div>
<div class="">Is your method for calculating average bandpower different from that by integral of PSD?</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
Yes this is different. An integral is a sum, and ‘my method’ is -as the name suggests- an average.<br class="">
<br class="">
<blockquote type="cite" class="">
<div class="">
<div style="caret-color: rgb(0, 0, 0); font-family: "Segoe UI"; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<div class="">2. about total band power.</div>
<div class="">How to calculate total band power instead of average band power in fieldtrip?</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
<div>What about multiplying the average with the number of frequency bins, assuming that with ’total band power’ you mean the same as ‘integral of PSD'?</div>
<div><br class="">
</div>
<div>Best wishes and happy computing,</div>
<div>Jan-Mathijs</div>
<div><br class="">
</div>
<div><br class="">
</div>
<br class="">
<blockquote type="cite" class="">
<div class="">
<div style="caret-color: rgb(0, 0, 0); font-family: "Segoe UI"; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<div class=""><br class="">
</div>
<div class="">Best,</div>
<div class="">Zhiwei</div>
</div>
<hr size="1" align="left" style="caret-color: rgb(0, 0, 0); font-family: "Segoe UI"; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; width: 210px; height: 1px;" class="">
<div style="caret-color: rgb(0, 0, 0); font-family: "Segoe UI"; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span class="">
<div style="margin: 10px; font-family: verdana; font-size: 10pt;" class="">
<div class=""><a href="mailto:fewaster@gmail.com" class="">fewaster@gmail.com</a></div>
</div>
</span></div>
<blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; caret-color: rgb(0, 0, 0); font-family: "Segoe UI"; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<div class=""> </div>
<div style="border-style: solid none none; border-top-width: 1pt; border-top-color: rgb(181, 196, 223); padding: 3pt 0cm 0cm;" class="">
<div style="padding: 8px; font-size: 12px; font-family: tahoma; background-color: rgb(239, 239, 239);" class="">
<div class=""><b class="">From:</b> <a href="mailto:fieldtrip@science.ru.nl" class="">Schoffelen, J.M. \(Jan Mathijs\) via fieldtrip</a></div>
<div class=""><b class="">Date:</b> 2022-09-06 22:03</div>
<div class=""><b class="">To:</b> <a href="mailto:fieldtrip@science.ru.nl" class="">FieldTrip discussion list</a></div>
<div class=""><b class="">CC:</b> <a href="mailto:janmathijs.schoffelen@donders.ru.nl" class="">Schoffelen, J.M. \(Jan Mathijs\)</a></div>
<div class=""><b class="">Subject:</b> Re: [FieldTrip] Calculating band power or power spectral density with ft_freqanalysis</div>
</div>
</div>
<div class="">
<div class="FoxDiv20221004095529468839" style="overflow-wrap: break-word;">Hi Zhiwei Fan,
<div class=""><br class="">
</div>
<div class="">Averaging across a spectral band these days is done with the ft_selectdata function:</div>
<div class=""><br class="">
</div>
<div class="">cfg = [];</div>
<div class="">cfg.frequency = [low high]</div>
<div class="">cfg.avgoverfreq = ‘yes’;</div>
<div class="">dataout = ft_freqanalysis(cfg, datain);</div>
<div class=""><br class="">
</div>
<div class="">Good luck,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""><br class="">
<blockquote type="cite" class="" style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;">
<div class="">On 2 Sep 2022, at 05:21, Francis (Zhiwei Fan) via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div class="">
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class="">Dear All,<o:p class=""></o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class=""><o:p class=""> </o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class="">I am attempting to calculate band power or power spectral density (then I can use bandpower() in Matlab to calculate band power) with<o:p class=""></o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class="">ft_freqanalysis but it seems does provide this function. I have found a similar question in <o:p class=""></o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class=""><o:p class=""> </o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class=""><a href="https://mailman.science.ru.nl/pipermail/fieldtrip/2020-February/039790.html" class="">https://mailman.science.ru.nl/pipermail/fieldtrip/2020-February/039790.html</a><o:p class=""></o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class=""><o:p class=""> </o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class="">However, no one has yet answered this question.<o:p class=""></o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class="">I want to know how to calculate band power or power spectral density in Fieldtrip. <o:p class=""></o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class=""><o:p class=""> </o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class="">Thanks in advance for your help,<o:p class=""></o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class="">Francis<o:p class=""></o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class=""><o:p class=""> </o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class="">Zhiwei Fan, Ph.D.<o:p class=""></o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class="">Post-doc | Abe lab<o:p class=""></o:p></span></pre>
<pre class="" style="margin: 0mm 0mm 0.0001pt; font-size: 12pt; font-family: "MS Gothic";"><span lang="EN-US" class=""><a href="https://urldefense.com/v3/__https://www.u.tsukuba.ac.jp/*abe.takashi.gp/__;fg!!HJOPV4FYYWzcc1jazlU!7fKm1v4hrZvcmNtCLJkiTTxFyctgS4iO5j_7yhGZHoryGlNv83zTXIjWs27mINTVdr-oPqYruYR7w8QHqUiUD4hKaafzhZ2KQ-xzuA$" class="">https://www.u.tsukuba.ac.jp/~abe.takashi.gp/</a></span><span lang="EN-US" class=""><o:p class=""></o:p></span></pre>
</div>
</div>
<span class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">_______________________________________________</span><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<span class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">fieldtrip
mailing list</span><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<a href="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br class="" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<a href="https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!7fKm1v4hrZvcmNtCLJkiTTxFyctgS4iO5j_7yhGZHoryGlNv83zTXIjWs27mINTVdr-oPqYruYR7w8QHqUiUD4hKaafzhZ0pCSAEuA$" class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">https://urldefense.com/v3/__https://doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!7fKm1v4hrZvcmNtCLJkiTTxFyctgS4iO5j_7yhGZHoryGlNv83zTXIjWs27mINTVdr-oPqYruYR7w8QHqUiUD4hKaafzhZ0pCSAEuA$</a></div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>