FPGA Central

World's 1st FPGA Portal

 FPGA Groups > DSP bandwidth of the Goertzel

 DSP comp.dsp newsgroup, mailing list

06-20-2005, 09:55 PM
 Thomas Magma Guest Posts: n/a
bandwidth of the Goertzel

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?

06-20-2005, 10:22 PM
 Tim Wescott Guest Posts: n/a
Re: bandwidth of the Goertzel

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
06-21-2005, 05:50 AM
 Clay S. Turner Guest Posts: n/a
Re: bandwidth of the Goertzel

"Thomas Magma" <[email protected]> wrote in message
news:[email protected]
> 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

06-21-2005, 03:00 PM
 Thomas Magma Guest Posts: n/a
Re: bandwidth of the Goertzel

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" <[email protected]> wrote in message
news:[email protected] ...
>
> "Thomas Magma" <[email protected]> wrote in message
> news:[email protected]
>> 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
>

 Bookmarks

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post porterboy DSP 1 08-13-2004 12:57 PM Le Phong DSP 3 04-21-2004 02:41 AM Jach DSP 1 04-09-2004 05:48 PM Clay S. Turner DSP 6 01-14-2004 02:44 AM kbc DSP 6 07-21-2003 10:05 AM

All times are GMT +1. The time now is 11:17 PM.