Goertzel's Algorithm
Goertzel's Algorithm
Goertzel's Algorithm
Some applications require only a few DFT frequencies. One example is frequency-shift keying
(FSK) (http://en.wikipedia.org/wiki/Frequency-shift_keying) demodulation, in which typically two
frequencies are used to transmit binary data; another example is DTMF (http://en.wikipedia.org
/wiki/DTMF), or touch-tone telephone dialing, in which a detection circuit must constantly monitor
the line for two simultaneous frequencies indicating that a telephone button is depressed.
Goertzel's algorithm reduces the number of real-valued multiplications by almost a factor of two
relative to direct computation via the DFT equation (http://cnx.org/contents/e23c86abf737-49e3-9e6a-f47172e3f688@6#DFTequation). Goertzel's algorithm is thus useful for
computing a few frequency values; if many or most DFT values are needed, FFT algorithms
(http://cnx.org/contents/26aa0672-1bf7-4237-850e-81c825504116@3) that compute all DFT
samples in O(N log N) operations are faster. Goertzel's algorithm can be derived by
converting the DFT equation (http://cnx.org/contents/01e3cf62-3ba9-4fc9bbde-d62220112b12@5) into an equivalent form as a convolution, which can be efficiently
implemented as a digital filter. For increased clarity, in the equations below the complex
exponential is denoted as
DFT equation can be
1 of 4
(i 2k )
N
4/9/2015 7:44 AM
2 of 4
X(k) = x(n)1WNnk
n=0
N1
= x(n)WNNkWNnk
n=0
N1
(Nn)(k)
= x(n)WN
n=0
= 0. The DFT coefficient equals the output of the difference equation at time
X(k) = y(N)
1 WNk z1
1 WNk
Y (z)
1
= H(z) =
=
=
k
k
X(z)
1
2
1 WNk z1
1 ((WN + WN )z z )
1 (2 cos( 2k
)
N
This system can be realized by the structure in Figure
4/9/2015 7:44 AM
3 of 4
Figure 1.
We want y(n) not for all n, but only for n = N. We can thus compute only the recursive part,
or just the left side of the flow graph in Figure, for n = [0, 1, , N], which involves only a
real/complex product rather than a complex/complex product as in a direct DFT equation), plus
one complex multiply
to get y(N)
= X(k).
NOTE
The input x(N) at time n = N must equal 0! A slightly more
efficient alternate implementation (http://www.mstarlabs.com
/dsp/goertzel/goertzel.html) that computes the full recursion only
through n = N 1 and combines the nonzero operations of the
final recursion with the final complex multiply can be found here
(http://www.mstarlabs.com/dsp/goertzel/goertzel.html), complete with
pseudocode (for real-valued data).
If the data are real-valued, only real/real multiplications and real additions are needed until the
final multiply.
COST
The computational cost of Goertzel's algorithm is thus 2N + 2 real
multiplies and 4N 2 real adds, a reduction of almost a factor of
two in the number of real multiplies relative to direct computation via
the DFT equation. If the data are real-valued, this cost is almost
halved again.
For certain frequencies, additional simplifications requiring even fewer multiplications are
4/9/2015 7:44 AM
4 of 4
possible. (For example, for the DC (k = 0) frequency, all the multipliers equal 1 and only
additions are needed.) A correspondence by C.G. Boncelet, Jr. describes some of these
additional simplifications. Once again, Goertzel's and Boncelet's algorithms are efficient for a few
DFT frequency samples; if more than log
4/9/2015 7:44 AM