Correlation Functions & Matched Filter

Interactive visualization of autocorrelation, cross-correlation, and matched filtering for signal processing education.

Signal A
Signal B
Correlation Result

Autocorrelation

The autocorrelation Rxx[τ] = Σ x[n]·x[n+τ] measures the similarity of a signal with a delayed copy of itself. It reaches its maximum at τ=0 (equal to the signal energy), is symmetric Rxx[τ]=Rxx[-τ], and reveals periodicities hidden in noisy signals. The Wiener-Khinchin theorem connects it to the power spectrum: Sxx(ω) = FFT{Rxx[τ]}.

Cross-Correlation

The cross-correlation Rxy[τ] = Σ x[n]·y[n+τ] measures similarity between two different signals as a function of delay. Unlike autocorrelation, it is not necessarily symmetric. Its peak location indicates the time offset between the two signals — essential for time-delay estimation, synchronization, and template matching.

Key Properties

  • Autocorrelation peak at τ=0 equals signal energy: Σ x²[n]
  • Autocorrelation is symmetric: Rxx[τ] = Rxx[-τ]
  • Cross-correlation peak location = time delay between signals
  • Wiener-Khinchin: S(ω) = FFT{R[τ]}, connecting time and frequency domains
  • Correlation is equivalent to convolution with time-reversed signal

Derivation & Principle

The matched filter is the optimal linear filter for maximizing the signal-to-noise ratio (SNR) in the presence of additive white noise. It convolves the received signal with a time-reversed copy of the known template: y[n] = Σ r[m]·h[n-m] where h[n] = s[-n]. The output peaks at the correct delay, providing the best possible detection performance for a known signal shape.

Barker Codes

Barker codes are binary sequences with excellent autocorrelation properties — the sidelobe level is at most 1 (or -1). Known Barker codes have lengths 2, 3, 4, 5, 7, 11, and 13. They are widely used in radar, sonar, and communications for pulse compression, where a long sequence is transmitted but the matched filter output produces a sharp peak, improving range resolution while maintaining energy.

Pulse Compression

Pulse compression transmits a long modulated pulse (chirp or coded) and compresses it at the receiver via matched filtering. This achieves the range resolution of a short pulse with the energy of a long pulse. The compression ratio equals the time-bandwidth product (BT). Linear FM chirps achieve compression through frequency sweep; phase-coded pulses use Barker or other codes.

Real-World Applications

  • Radar: detecting echo pulses and measuring target range via delay estimation
  • Sonar: underwater target detection and acoustic ranging
  • GPS: satellite signal acquisition using Gold code correlation
  • EEG/ECG: detecting evoked potentials and repetitive patterns in biological signals
  • Audio fingerprinting: Shazam-style music recognition via spectral peak cross-correlation
  • Pattern recognition: template matching in images and time series