Summing FFT bins - MathOverflow [closed] most recent 30 from http://mathoverflow.net 2013-05-23T03:55:52Z http://mathoverflow.net/feeds/question/59280 http://www.creativecommons.org/licenses/by-nc/2.5/rdf http://mathoverflow.net/questions/59280/summing-fft-bins Summing FFT bins Anon 2011-03-23T10:31:01Z 2011-03-23T10:31:01Z <p>What is the correct way to sum a range of frequencies in an FFT? I heard that I had to sum the squares after multiplying by the frequency.</p> <p>Here's what I'm doing:</p> <pre><code> freqDomain = abs(fft(signal.*window)); %FFT freqDomain = freqDomain(2:(windowSize/2+1)); %We're only interested in the first half freqDomain = freqDomain .* (1:windowSize/2); % Convert to PSD lowFreq = freqDomain(lowFreqPeriod(2):lowFreqPeriod(1)); %Extract the range we need highFreq = freqDomain(highFreqPeriod(2):highFreqPeriod(1)); lowFreq = sum(lowFreqDomain .^ 2); % sum of squares highFreq = sum(highFreqDomain .^ 2); </code></pre> <p>The code works, and I'm getting what I think is a decent result, but is it mathmatically right?</p>