Basic Goertzel (EE Tip #120)

The basic Goertzel transform, which has been around since 1958, was derived from the discrete Fourier transform (DFT). It’s an extremely efficient method of detecting a single frequency component in a block of input data. Figure 1 depicts the signal flow for the basic Goertzel algorithm as each sample is processed.

Figure 1:  Figure 1—The signal flow of the basic Goertzel transform produces an output (y0) for each sample processed. The output is a combination of the current ADC sample added to the product of the previous output (y1) multiplied by a constant minus the previous output (y2). After a block of samples has been processed, the sum of the squares of y1 and y2 are computed to determine the relative amplitude of a particular frequency.

Figure 1: The signal flow of the basic Goertzel transform produces an output (y0) for each sample processed. The output is a combination of the current ADC sample added to the product of the previous output (y1) multiplied by a constant minus the previous output (y2). After a block of samples has been processed, the sum of the squares of y1 and y2 are computed to determine the relative amplitude of a particular frequency.

Figure 1 may be written as Equation 1. y0 is the current processed output. x0 is the current ADC sample. y1 is the previously processed output, and y2 is the next previously processed output. m is the frequency domain bin number. N is the sample block size. Input samples are processed on a sample-by-sample basis. Processing continues over a block of input data of the length N. After a block of data has been processed, magnitude and phase information for the signal of interest is contained in the y1 and y2 variables.

Equations 1 - 4

Equations 1 – 4

One of the advantages of the Goertzel transform is that the magnitude (and phase) computation needs to be performed only at the end of a block of data. After a block of data has passed through Equation 1, the relative magnitude may be determined by computing the sum of the squares of the real and imaginary components.

The real component (RC) is described as Equation 2. The imaginary component is calculated with Equation 3. The squared magnitude is computed with Equation 4.

For tone detection only, phase information may be ignored. It’s sufficient to compute the square of the magnitude to determine the relative power of a signal.—Eric Kiser, “Digital Decoding Simplified,” Circuit Cellar 182, 2005. The issue is available in the CC Webshop.