ArticleslgStudy

computer science

Goertzel algorithm

Goertzel algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Goertzel algorithm rather than just read about it. In short: The Goertzel algorithm is a technique in digital signal processing (DSP) for efficient evaluation of the individual terms of the discrete Fourier transform (DFT). It is useful in certain practical applications, such as recognition of dual-tone multi-frequency signaling (DTMF) tones produced by the push buttons of the keypad of a traditional analog telephone.

Key takeaways

  • Goertzel algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Goertzel algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Goertzel algorithm from memory before moving on to harder problems.

Reference excerpt

The Goertzel algorithm is a technique in digital signal processing (DSP) for efficient evaluation of the individual terms of the discrete Fourier transform (DFT). It is useful in certain practical applications, such as recognition of dual-tone multi-frequency signaling (DTMF) tones produced by the push buttons of the keypad of a traditional analog telephone. The algorithm was first described by Gerald Goertzel in 1958. Like the DFT, the Goertzel algorithm analyses one selectable frequency component from a discrete signal. Unlike direct DFT calculations, the Goertzel algorithm applies a single real-valued coefficient at each iteration, using real-valued arithmetic for real-valued input sequences. For covering a full spectrum (except when using for continuous stream of data where coefficients are reused for subsequent calculations, which has computational complexity equivalent of sliding DFT), the Goertzel algorithm has a higher order of complexity than fast Fourier transform (FFT) algorithms, but for computing a small number of selected frequency components, it is more numerically efficient. The simple structure of the Goertzel algorithm makes it well suited to small processors and embedded applications. The Goertzel algorithm can also be used "in reverse" as a sinusoid synthesis function, which requires only 1 multiplication and 1 subtraction per generated sample.

The algorithm The main calculation in the Goertzel algorithm has the form of a digital filter, and for this reason the algorithm is often called a Goertzel filter. The filter operates on an input sequence x [ n ] {\displaystyle x[n]} in a cascade of two stages with a parameter ω 0 {\displaystyle \omega _{0}} , giving the frequency to be analysed, normalised to radians per sample. The first stage calculates an intermediate sequence, s [ n ] {\displaystyle s[n]} :

The second stage applies the following filter to s [ n ] {\displaystyle s[n]} , producing output sequence y [ n ] {\displaystyle y[n]} :

The first filter stage can be observed to be a second-order IIR filter with a direct-form structure. This particular structure has the property that its internal state variables equal the past output values from that stage. Input values x [ n ] {\displaystyle x[n]} for n < 0 {\displaystyle n<0} are presumed all equal to 0. To establish the initial filter state so that evaluation can begin at sample x [ 0 ] {\displaystyle x[0]} , the filter states are assigned initial values s [ − 2 ] = s [ − 1 ] = 0 {\displaystyle s[-2]=s[-1]=0} . To avoid aliasing hazards, frequency ω 0 {\displaystyle \omega _{0}} is often restricted to the range 0 to π (see Nyquist–Shannon sampling theorem); using a value outside this range is not meaningless, but is equivalent to using an aliased frequency inside this range, since the exponential function is periodic with a period of 2π in ω 0 {\displaystyle \omega _{0}} . The second-stage filter can be observed to be a FIR filter, since its calculations do not use any of its past outputs. Z-transform methods can be applied to study the properties of the filter cascade. The Z transform of the first filter stage given in equation (1) is

The Z transform of the second filter stage given in equation (2) is

The combined transfer function of the cascade of the two filter stages is then

This can be transformed back to an equivalent time-domain sequence, and the terms unrolled back to the first input term at index n = 0 {\displaystyle n=0} :

Numerical stability It can be observed that the poles of the filter's Z transform are located at e + j ω 0 {\displaystyle e^{+j\omega _{0}}} and e − j ω 0 {\displaystyle e^{-j\omega _{0}}} , on a circle of unit radius centered on the origin of the complex Z-transform plane. This property indicates that the filter process is marginally stable and vulnerable to numerical-error accumulation when computed using low-precision arithmetic and long input sequences. A numerically stable version was proposed by Christian Reinsch.

DFT computations For the important case of computing a DFT term, the following special restrictions are applied.

The filtering terminates at index n = N {\displaystyle n=N} , where N {\displaystyle N} is the number of terms in the input sequence of the DFT. The frequencies chosen for the Goertzel analysis are restricted to the special form

The index number k {\displaystyle k} indicating the "frequency bin" of the DFT is selected from the set of index numbers

Making these substitutions into equation (6) and observing that the term e + j 2 π k = 1 {\displaystyle e^{+j2\pi k}=1} , equation (6) then takes the following form:

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Goertzel algorithm

Start with the simplest possible case. Write down what Goertzel algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Goertzel algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Goertzel algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Goertzel algorithm

In research
Goertzel algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Goertzel algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Goertzel algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Digital signal processing, Fast Fourier transforms, so understanding it makes those chapters shorter.
In everyday life
Look for Goertzel algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Goertzel algorithm” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Goertzel algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Goertzel algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Goertzel algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Goertzel algorithm in simple terms?

The Goertzel algorithm is a technique in digital signal processing (DSP) for efficient evaluation of the individual terms of the discrete Fourier transform (DFT). It is useful in certain practical applications, such as recognition of dual-tone multi-frequency signaling (DTMF) tones produced by the…

Why does Goertzel algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Goertzel algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Goertzel algorithm.

Tags

  • Digital signal processing
  • Fast Fourier transforms

Keep exploring