# Estimate mean amplitude in frequency range using fft

I would like to roughly estimate the mean amplitude over a frequency range (2-3hz). My impression was that I could transform the data using FFT, and just take the mean of the sub part of the output (absolute values).

However, the input I provide to numpy.fft.fft is in the range -1.5 to 2.5, while the output (absolute values) are in the range of about 0-6500. Do I need to scale the y-values somehow?

Any other suggestions on how to roughly estimate the mean amplitude of a frequency range?

Update:

The problem is that I am doing peak detection and want to discriminate out (as noise) all peaks that are smaller than 10% of the rest of the peaks. The majority of the peaks are expected to have rather equal amplitudes, and it is 10% of this amplitude that all peaks must at least be.

• Hi, welcome to dsp stack exchange. Why don't you share your actual code and your test data? The fft should return complex numbers where the magnotude represent the amplitude integral. Also, you could use some other approach like power estimation at the output of a bandpass filter. Goertzel algorithm may also interest you, but to guide you right, we would need you to explain your problem, not what you think is the solution to your problem (evaluating mean amplitude). Jan 14 '18 at 20:46
• Thanks, updated the question with a brief explanation of the problem. Jan 14 '18 at 22:33
• It sounds like your peak detection works off of the relative amplitudes, so why would you need to scale? Is the issue that you are confused why some of the FFT samples have magnitudes such much greater than any of the input samples? Jan 15 '18 at 2:18
• You might find this helpful too.
– A_A
Jan 15 '18 at 8:52

The Discrete Fourier Transform is a summation :

$$X_k =\sum_{n=0}^{N-1}x_ne^{-j2\pi kn/N}$$

Which means, the more data you have, the bigger the output mangitude. What you can do is normalizing your output by dividing the magnitude of the result by the number of samples in your signal.

I would invite you to check this question for more details.

On a side note, you may want to consider zero padding for better peak detection accuracy. Also, if you intend to filter out the noise by suppressing the peaks that you consider noise and then do an inverse FFT, you will gain to read this other question