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.
Here's what I'm doing:
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);
The code works, and I'm getting what I think is a decent result, but is it mathmatically right?

