bandwidth of the Goertzel

Started by June 20, 2005
Say I set up my Goertzel algorithm to detect a 1000Hz tone. What happens if
the tone coming in is 1020Hz?How about 1100Hz? Will I still get gain from my
Goertzel detector? I guess my question is, what is the shape and bandwidth
of the Goertzel when used as a tone detector? I'm guessing it has something
to do with the amount of samples processed...is there a formula for this?

Thomas Magma wrote:
> Say I set up my Goertzel algorithm to detect a 1000Hz tone. What happens if > the tone coming in is 1020Hz?How about 1100Hz? Will I still get gain from my > Goertzel detector? I guess my question is, what is the shape and bandwidth > of the Goertzel when used as a tone detector? I'm guessing it has something > to do with the amount of samples processed...is there a formula for this? > >
The Goertzel algorithm implements an IIR filter that has an impulse response equal to sin(q0 * n), where q0 is frequency of the band center in radians/sample and n is the sample offset. If you run the Goertzel algorithm for N samples, then the Goertzel algorithm will have a response exactly equal to a FIR filter who's coefficents are calculated from: { sin(q0 * k) 0 <= k <= N-1 h(k) = { . { 0 otherwise Barring stupid math errors on my part such a filter will have a frequency-domain shape of H(theta) = sin((q0 - theta) * N/2) / (q0 - theta) + sin((q0 + theta) * N/2) / (q0 + theta) -- i.e. a pair of sinc functions centered on q0 and -q0. So the shorter your filter length is the wider the bandwidth is going to be. For infinite filter lengths, of course, your filter will be infinitely narrow but you may experience some problems with overflow. -- ------------------------------------------- Tim Wescott Wescott Design Services http://www.wescottdesign.com
"Thomas Magma" <somewhere@overtherainbow.com> wrote in message
news:43Gte.47813\$El.1433@pd7tw1no...
> Say I set up my Goertzel algorithm to detect a 1000Hz tone. What happens > if the tone coming in is 1020Hz?How about 1100Hz? Will I still get gain > from my Goertzel detector? I guess my question is, what is the shape and > bandwidth of the Goertzel when used as a tone detector? I'm guessing it > has something to do with the amount of samples processed...is there a > formula for this? >
Hello Thomas, Yes there is a formula for this. The function is called a Dirichlet function - otherwise known as a periodic sync function. This is found by finding the DFT of a rectangular window. Remember the Goertzel algo is a way of finding the DFT of a function for a single bin's frequency. The gain formula is X(f) = (1/N)*sin(pi*f*N/F)/sin(pi*f/F) where N is the number of samples, f is the difference between your signal's frequency and the analysis frequency, and F is the sample rate. For example let N=205, the sample rate is 8000Hz, your signal's freq. is 697 Hz, and you are using bin number 18, so the center frequency is simply 702.439Hz. Then f = 697 - 702.439 = - 5.439 Hz. X(f) then equals 0.96835 or -0.279 dB. Also the energy loss is 1-X(f)*X(f) = 0.06229 or 6.229% of the energy will show up in the other bins. This last formula is the result of Bessel's identity (special case of Parseval's theorem) IHTH, Clay
Thanks Clay, I think this is exactly what I am looking for. I will play with
the math and then sweep simulated signal data using the Goertzel to verify.

Thomas

"Clay S. Turner" <Physics@Bellsouth.net> wrote in message
news:4_Mte.149703\$J25.60996@bignews6.bellsouth.net...
> > "Thomas Magma" <somewhere@overtherainbow.com> wrote in message > news:43Gte.47813\$El.1433@pd7tw1no... >> Say I set up my Goertzel algorithm to detect a 1000Hz tone. What happens >> if the tone coming in is 1020Hz?How about 1100Hz? Will I still get gain >> from my Goertzel detector? I guess my question is, what is the shape and >> bandwidth of the Goertzel when used as a tone detector? I'm guessing it >> has something to do with the amount of samples processed...is there a >> formula for this? >> > > Hello Thomas, > > Yes there is a formula for this. The function is called a Dirichlet > function - otherwise known as a periodic sync function. This is found by > finding the DFT of a rectangular window. Remember the Goertzel algo is a > way of finding the DFT of a function for a single bin's frequency. > > The gain formula is > > X(f) = (1/N)*sin(pi*f*N/F)/sin(pi*f/F) > > where N is the number of samples, > > f is the difference between your signal's frequency and the analysis > frequency, > > and F is the sample rate. > > For example let N=205, the sample rate is 8000Hz, your signal's freq. is > 697 Hz, and you are using bin number 18, so the center frequency is simply > 702.439Hz. > > Then f = 697 - 702.439 = - 5.439 Hz. > > X(f) then equals 0.96835 or -0.279 dB. > > Also the energy loss is 1-X(f)*X(f) = 0.06229 or 6.229% of the energy will > show up in the other bins. This last formula is the result of Bessel's > identity (special case of Parseval's theorem) > > IHTH, > > Clay >