# Estimating the amplitude of a particular frequency

I am relatively new to DSP and have been reading a lot on the internet. I have a couple of questions.

I have a signal in the form of a function $$f(x) = A_0 + A_1 \cos(\omega_1 x) + A_2 \cos(\omega_2 x)+...+ A_n \cos(\omega_n x).$$ I have $f(x)$ and I know the minimum and maximum frequencies. $f(x)$ can have really high frequencies.

a) I need to find the amplitude $A_p$ of a particular frequency $\omega_p$ in $f(x)$. One way to do this is, I could get sample points from $f(x)$ sampling at greater than Nyquist rate and do an FFT and find the amplitude. But if $f(x)$ has really high frequencies, the sampling would take most of the time. If i am interested only in estimating the amplitude $A_p$, is there another way, a faster way, of doing this. In the best case, I would like to estimate $A_p$ to within 0.5 of its actual value.

b)If I want $A_0$, the DC component, I can compute the average of $f(x)$ but with high frequencies in $f(x)$ that would mean high sampling rates. Any other faster way of doing this?

c)The FFT takes $O(n\log(n))$ if $n$ is the size of the input and returns the magnitudes for $n$ different frequencies. If we are only interested in one particular frequency we should be able to alter the source code so that it would take only $O(\log(n))$, right?

The usual way to estimate the amplitude of a particular frequency is to use the Goertzel algorithm. There is a good write-up by Rick Lyons here.

Even though Rick's writeup is about single tone detection, it can be applied when multiple tones are present, too.

• Unless they are close relative to the observation time. Then the estimation isn't good.
– Royi
Commented Jun 19, 2018 at 11:57

Maybe you have a look at Goertzels Algorithm.

• Beat me to it! :-) +1
– Peter K.
Commented Jan 8, 2014 at 18:20
• OP states that he only knows the bounds of the frequencies w1...wn, not the individual values. Goertzel requires knowing the frequency wp. Is it known?
– John
Commented Jan 8, 2014 at 18:58
• @John : Good point! I missed that piece. :-(
– Peter K.
Commented Jan 8, 2014 at 19:00
• yes, i know w1, wp and wn Commented Jan 8, 2014 at 19:06