Skip to content
SpecializedSource checked

Goertzel Algorithm

Efficiently measures one selected frequency bin from a signal.

Quick Facts

Compact metadata for implementation and discovery.

Category
Signal Processing
Difficulty
Intermediate
Family
Frequency Analysis
Tier
Specialized
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
1
Code example
Ready
Visualization
Ready

Overview

The Goertzel Algorithm uses a recurrence to compute a single DFT bin, making it useful when only a few frequencies matter.

Core Concepts

single DFT binsecond-order recurrencefrequency powersample rate

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(n)

Average

O(n)

Worst

O(n)

Space

O(1)

When to Use

  • Use when only one or a few frequency bins need to be measured.
  • Use when tone detection is a central requirement.

When Not to Use

  • Avoid when a full spectrum is needed for each signal window.
  • Avoid when the sampling rate, window size, or stationarity assumptions do not hold.

What It Does

  • Targets one frequency bin
  • Runs a second-order recurrence
  • Computes bin power or coefficient

Use Cases

  • Tone detection
  • DTMF decoding
  • Embedded frequency checks

Inputs

  • Signal samples
  • Target frequency bin

Outputs

  • Selected frequency magnitude or coefficient

Key Formulas (1)

Goertzel recurrence

s[n] = x[n] + 2·cos(2·π·k/N)·s[n−1] − s[n−2]
s[n] = x[n] + 2*cos(2*pi*k/N)*s[n-1] - s[n-2]

Accumulates the selected frequency bin through a recurrence.

Pseudocode

  1. 1.Choose the target bin
  2. 2.Compute the recurrence coefficient
  3. 3.Run the recurrence across samples
  4. 4.Convert final state to magnitude or complex bin value

Canonical Example

Input
samples contain a 697 Hz tone
Output
power at 697 Hz bin is high
Explanation
The recurrence measures the target tone without computing every DFT bin.

Implementation Notes

  • Keep sample rate, window length, and target bin calculation together.
  • Plot or inspect both the original and processed signal for small test cases.
  • Keep a tiny example with expected output beside the implementation.

Common Pitfalls

  • Choosing a bin that does not match the sample rate and target frequency causes leakage.
  • Boundary handling and phase response can change the result in visible or audible ways.
  • Not defining boundary, empty, or degenerate inputs before implementation.

Interactive Mechanism Walkthrough

Iterative Convergence & State Trajectory

Show one frequency bin accumulating energy while other bins are ignored.

Goertzel Algorithm mechanism walkthrough step 1 of 4x₀x₁x₂x*
Step 1 of 4: Choose the target bin
signal-transform

Notes

FFT is usually better when many bins are needed.

Sources (1)

What each reference supports for this entry.

Goertzel 1958

Paper

Original reference for evaluating finite trigonometric series efficiently.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Goertzel efficiently evaluates selected DFT bins.

Tags

Signal ProcessingFrequency DomainSpectral AnalysisAudio Processing