<div dir="ltr">Dear Chong,<div><br></div><div>I can't give you a complete check on your code but here is my code to compute frequency-binned powers. Consider using this solution for each block in your case.</div><div><br></div><div>Makoto</div><div><br></div>%%%%%%%%%%%%%%%%%%%<br>% for your epoched data, channel 2<br>[spectra,freqs] = spectopo(EEG.data(2,:,:), 0, EEG.srate);<br><br>% delta=1-4, theta=4-8, alpha=8-13, beta=13-30, gamma=30-80<br>deltaIdx = find(freqs>1 & freqs<4);<br>thetaIdx = find(freqs>4 & freqs<8);<br>alphaIdx = find(freqs>8 & freqs<13);<br>betaIdx  = find(freqs>13 & freqs<30);<br>gammaIdx = find(freqs>30 & freqs<80);<br><br>% compute absolute power<br>deltaPower = mean(10.^(spectra(deltaIdx)/10));<br>thetaPower = mean(10.^(spectra(thetaIdx)/10));<br>alphaPower = mean(10.^(spectra(alphaIdx)/10));<br>betaPower  = mean(10.^(spectra(betaIdx)/10));<br>gammaPower = mean(10.^(spectra(gammaIdx)/10));<br>%%%%%%%%%%%%%%%%%<div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 4, 2016 at 11:45 PM, Chong Li <span dir="ltr"><<a href="mailto:C.Li-1@tudelft.nl" target="_blank">C.Li-1@tudelft.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="ZH-CN" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif";color:#1f497d">Dear Makoto,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif";color:#1f497d">Thank you for your reply.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif";color:#1f497d">I checked NBT, and I think NBT will be very useful for ongoing neuronal activity. Now, EEGLAB should be enough to fit my needs for offline
 analysis. <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif";color:#1f497d">I am using the following codes to compute (alpha power/theta power) over the first 20s period, and then update every 2s using a 20s moving
 window. Could you please help me to check if it is correct? <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:blue">for</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black"> i= 1:6 %channel 1-6</span><span lang="EN-US" style="font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">       
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:blue">for</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black"> j = 1:50 %I have 2 mins data, 20s moving window stops at 100s</span><span lang="EN-US" style="font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">            [power, freq] = spectopo(EEG.data(i, (2*(j-1)*128+1):(20*128+2*(j-1)*128)), 0, 128); %compute the power spectra using
 a 20s moving window</span><span lang="EN-US" style="font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">            pow=10.^power; %transfer db to avoid negative number</span><span lang="EN-US" style="font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">            alpha(i,j) = sum(pow(8:12))/sum(pow(1:50));</span><span lang="EN-US" style="font-family:"Courier New"">
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">% alpha percent power of the total power<u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">            theta(i,j) = sum(pow(4:7))/sum(pow(1:50));</span><span lang="EN-US" style="font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">            cog(i,j) = (alpha(i,j)/theta(i,j));% the ratio I need</span><span lang="EN-US" style="font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:black">       
</span><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:blue">end</span><span lang="EN-US" style="font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span lang="EN-US" style="font-size:10.0pt;font-family:"Courier New";color:blue">end</span><span lang="EN-US" style="font-family:"Courier New""><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif";color:#1f497d">Thank you for your help in advance.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif";color:#1f497d">Best regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:"Times New Roman","serif";color:#1f497d">Chong<u></u><u></u></span></p>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span style="font-size:10.0pt">发件人<span lang="EN-US">:</span></span></b><span lang="EN-US" style="font-size:10.0pt"> Makoto Miyakoshi [mailto:<a href="mailto:mmiyakoshi@ucsd.edu" target="_blank">mmiyakoshi@ucsd.edu</a>]
<br>
</span><b><span style="font-size:10.0pt">发送时间<span lang="EN-US">:</span></span></b><span lang="EN-US" style="font-size:10.0pt"> 2016</span><span style="font-size:10.0pt">年<span lang="EN-US">4</span>月<span lang="EN-US">5</span>日<span lang="EN-US"> 13:30<br>
</span><b>收件人<span lang="EN-US">:</span></b><span lang="EN-US"> Chong Li<br>
</span><b>抄送<span lang="EN-US">:</span></b><span lang="EN-US"> EEGLAB List<br>
</span><b>主题<span lang="EN-US">:</span></b><span lang="EN-US"> Re: [Eeglablist] bandwidth powers calculation over time<u></u><u></u></span></span></p>
</div><div><div class="h5">
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">Dear Chong,<u></u><u></u></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">You may want to try Simon-Shlomo Poil's NBT. Should fit your needs, I believe.<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><a href="https://www.nbtwiki.net/" target="_blank">https://www.nbtwiki.net/</a><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Makoto<u></u><u></u></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">On Tue, Mar 29, 2016 at 7:25 PM, Chong Li <<a href="mailto:C.Li-1@tudelft.nl" target="_blank">C.Li-1@tudelft.nl</a>> wrote:<u></u><u></u></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">Hi everyone,<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I have problems in calculating (alpha power/theta power) over time. I have studied the tutorial, currently I am able to reject the artifacts using visual inspection
 and ICA. I can also calculate (alpha power/theta power) over channels using EEGLAB GUI. But I still have problems computing this correlation over time. Since I don't have experience in EEG analysis, any help would be appreciated.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">I collected the data using EMOTIV EPOC headset. In my analysis, I would like to see the correlation between alpha and theta. To normalize the power, these bandwidth
 powers will be divided by total power. Then I want to calculate (alpha power/theta power) over the first 20s period, and then update every 2s using a 20s moving window.
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks for the help in advance.
<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US" style="color:black">--
</span><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Arial","sans-serif";color:black">Chong Li
</span></b><span lang="EN-US" style="font-size:7.5pt;font-family:"Times New Roman","serif";color:black">PhD student
<br>
Department of Design Engineering<br>
Faculty of Industrial Design Engineering<br>
Delft University of Technology<br>
Landbergstraat 15, 2628 CE Delft, The Netherlands </span><span lang="EN-US"><u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"> <u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><br>
_______________________________________________<br>
Eeglablist page: <a href="http://sccn.ucsd.edu/eeglab/eeglabmail.html" target="_blank">
http://sccn.ucsd.edu/eeglab/eeglabmail.html</a><br>
To unsubscribe, send an empty email to <a href="mailto:eeglablist-unsubscribe@sccn.ucsd.edu" target="_blank">
eeglablist-unsubscribe@sccn.ucsd.edu</a><br>
For digest mode, send an email with the subject "set digest mime" to <a href="mailto:eeglablist-request@sccn.ucsd.edu" target="_blank">
eeglablist-request@sccn.ucsd.edu</a><u></u><u></u></span></p>
</div>
<p class="MsoNormal"><span lang="EN-US"><br>
<br clear="all">
<u></u><u></u></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
</div>
<p class="MsoNormal"><span lang="EN-US">-- <u></u><u></u></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">Makoto Miyakoshi<br>
Swartz Center for Computational Neuroscience<br>
Institute for Neural Computation, University of California San Diego<u></u><u></u></span></p>
</div>
</div>
</div>
</div></div></div>
</div>

</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">Makoto Miyakoshi<br>Swartz Center for Computational Neuroscience<br>Institute for Neural Computation, University of California San Diego<br></div></div>
</div></div>