๐Ÿ“šSignal Processing

Common Digital Signal Processing Algorithms

Study smarter with Fiveable

Get study guides, practice questions, and cheatsheets for all your subjects. Join 500,000+ students with a 96% pass rate.

Get Started

Why This Matters

Digital signal processing algorithms form the computational backbone of everything from streaming audio to medical imaging. In this course, you're being tested on more than just knowing what each algorithm does. You need to understand why we choose one approach over another, how transforms relate to each other mathematically, and what trade-offs engineers face when processing real-world signals. These algorithms demonstrate core principles like time-frequency duality, computational efficiency, filter stability, and multi-resolution analysis.

The algorithms below aren't isolated techniques; they're interconnected tools that build on Fourier theory. The FFT makes the DFT practical, convolution connects filtering to frequency response, and wavelets extend Fourier analysis to handle signals that change over time. Don't just memorize definitions. Know what problem each algorithm solves and when you'd reach for one tool instead of another.


Frequency-Domain Transforms

These algorithms convert signals from the time domain to the frequency domain, revealing spectral content that's hidden in raw samples. The core principle: any signal can be decomposed into sinusoidal components, and working in the frequency domain often simplifies analysis and processing.

Discrete Fourier Transform (DFT)

The DFT is the mathematical foundation for spectral analysis of discrete signals. Given NN time-domain samples, it produces NN frequency-domain coefficients via:

X[k]=โˆ‘n=0Nโˆ’1x[n]โ€‰eโˆ’j2ฯ€kn/N,k=0,1,โ€ฆ,Nโˆ’1X[k] = \sum_{n=0}^{N-1} x[n] \, e^{-j2\pi kn/N}, \quad k = 0, 1, \ldots, N-1

  • Periodicity assumption means the DFT treats your signal as if it repeats infinitely. If the signal isn't periodic within the analysis window, this creates spectral leakage (energy smearing across frequency bins).
  • Computational complexity of O(N2)O(N^2) makes direct computation impractical for large datasets, since every output bin requires a sum over all NN input samples. This motivates the need for faster algorithms.

Fast Fourier Transform (FFT)

The FFT computes the exact same result as the DFT, just far more efficiently. It's what makes real-time spectral analysis possible.

  • Reduces complexity from O(N2)O(N^2) to O(Nlogโก2N)O(N \log_2 N) by exploiting symmetry and periodicity in the DFT's complex exponentials. For N=1024N = 1024, that's roughly a 100x speedup.
  • Divide-and-conquer strategy recursively splits the NN-point DFT into smaller DFTs. The most common variant is the Cooley-Tukey radix-2 algorithm, which requires NN to be a power of 2. Radix-4 and split-radix variants also exist for further gains.
  • Ubiquitous in applications including audio processing, radar, medical imaging, and telecommunications. If you're doing frequency analysis on a computer, you're almost certainly using an FFT under the hood.

Discrete Cosine Transform (DCT)

The DCT decomposes a signal using only cosine basis functions, producing purely real coefficients for real-valued inputs.

  • Strong energy compaction is its defining advantage. Most of a typical signal's energy gets packed into just a few low-frequency DCT coefficients, which is exactly what you want for compression.
  • Powers JPEG and MPEG compression. In JPEG, each 8ร—8 pixel block is transformed via DCT, and the many near-zero high-frequency coefficients are quantized away with little perceptual loss.
  • Handles boundaries better than the DFT because cosine basis functions implicitly create a symmetric extension of the signal at its edges, avoiding the discontinuities that cause leakage in the DFT.

Compare: DFT vs. DCT: both decompose signals into frequency components, but DCT uses only cosines and produces real outputs for real inputs. DCT's superior energy compaction makes it the go-to for compression, while DFT (via FFT) dominates general spectral analysis. If a question asks about image or video compression, DCT is your answer.


Digital Filtering Architectures

Filters modify signals by attenuating or amplifying specific frequency components. The key distinction: whether the filter uses feedback from past outputs determines its impulse response length, stability properties, and phase characteristics.

Finite Impulse Response (FIR) Filtering

An FIR filter computes each output sample as a weighted sum of the current and past MM input samples:

y[n]=โˆ‘k=0Mbkโ€‰x[nโˆ’k]y[n] = \sum_{k=0}^{M} b_k \, x[n-k]

There's no feedback, so the impulse response lasts exactly M+1M+1 samples and then dies to zero.

  • Always stable. Because there are no feedback paths (no poles outside the origin in the z-plane), an FIR filter cannot become unstable regardless of coefficient values.
  • Achieves exactly linear phase when the coefficients are symmetric (bk=bMโˆ’kb_k = b_{M-k}). Linear phase means all frequency components are delayed by the same amount, preserving the waveform's shape. This is critical for audio, communications, and biomedical signals.
  • Higher computational cost than IIR for equivalent frequency selectivity. Achieving a sharp cutoff with an FIR filter can require hundreds of taps, while an IIR filter might need only a handful of coefficients.

Infinite Impulse Response (IIR) Filtering

An IIR filter feeds past output samples back into the computation:

y[n]=โˆ‘k=0Mbkโ€‰x[nโˆ’k]โˆ’โˆ‘k=1Lakโ€‰y[nโˆ’k]y[n] = \sum_{k=0}^{M} b_k \, x[n-k] - \sum_{k=1}^{L} a_k \, y[n-k]

This feedback means the impulse response theoretically extends forever (though it decays for stable filters).

  • Computationally efficient compared to FIR for similar magnitude response. A 4th-order IIR Butterworth lowpass can match a frequency response that would take 50+ FIR taps.
  • Introduces nonlinear phase, which distorts the shape of waveforms passing through the filter. This can be mitigated with zero-phase filtering (forward-backward filtering) in offline applications.
  • Stability is not guaranteed. You must verify that all poles of the transfer function lie strictly inside the unit circle in the z-plane. Poor coefficient quantization in fixed-point implementations can push poles outside, causing the filter to blow up.

Compare: FIR vs. IIR: FIR guarantees stability and linear phase at the cost of more computation, while IIR achieves sharper responses with fewer coefficients but risks instability and phase distortion. If a question emphasizes phase preservation, FIR is the answer. If it emphasizes efficiency or analog filter equivalence, think IIR.


Fundamental Signal Operations

These operations are the building blocks connecting time-domain processing to frequency-domain analysis. Understanding convolution and correlation is essential because they underpin filtering, system analysis, and signal detection.

Convolution

Convolution is how filtering actually works mathematically. For a linear time-invariant (LTI) system with impulse response h[n]h[n], the output is:

y[n]=x[n]โˆ—h[n]=โˆ‘k=โˆ’โˆžโˆžx[k]โ€‰h[nโˆ’k]y[n] = x[n] * h[n] = \sum_{k=-\infty}^{\infty} x[k] \, h[n-k]

  • Convolution in time equals multiplication in frequency. This duality is one of the most powerful results in signal processing: Y(ejฯ‰)=X(ejฯ‰)โ‹…H(ejฯ‰)Y(e^{j\omega}) = X(e^{j\omega}) \cdot H(e^{j\omega}). It means you can filter a signal by transforming to the frequency domain, multiplying, and transforming back.
  • FFT-based fast convolution exploits this duality to reduce the cost from O(N2)O(N^2) to O(NlogโกN)O(N \log N). For long signals, overlap-add or overlap-save methods break the signal into blocks and convolve each block via FFT.

Correlation

Correlation measures the similarity between two signals as a function of a time lag ฯ„\tau. It's mathematically similar to convolution, but without time-reversing one signal:

Rxy[ฯ„]=โˆ‘nx[n]โ€‰y[n+ฯ„]R_{xy}[\tau] = \sum_{n} x[n] \, y[n + \tau]

  • Cross-correlation finds time delays between related signals. In radar, you correlate the transmitted pulse with the received echo; the lag at the correlation peak gives you the round-trip delay (and thus the target's range). GPS and sonar work on the same principle.
  • Auto-correlation (correlating a signal with itself) reveals periodicity and is used in pitch detection, power spectral estimation (via the Wiener-Khinchin theorem), and characterizing random processes.

Compare: Convolution vs. Correlation: both slide one signal across another, but convolution time-reverses one signal (for filtering) while correlation does not (for similarity measurement). In the frequency domain, convolution corresponds to Xโ‹…HX \cdot H, while correlation corresponds to Xโ‹…Yโˆ—X \cdot Y^* (multiplication by the complex conjugate).


Spectral Analysis Techniques

Real-world signals are finite, and how we handle their boundaries dramatically affects frequency analysis. Windowing addresses the fundamental tension between frequency resolution and spectral leakage.

Windowing

When you compute the DFT of a finite-length signal, you're implicitly multiplying the true signal by a rectangular window (ones inside, zeros outside). This abrupt truncation creates sharp edges that produce artificial high-frequency content in the spectrum, known as spectral leakage.

Window functions taper the signal smoothly to zero at its edges, reducing leakage at the cost of some frequency resolution.

  • The core trade-off is main lobe width vs. side lobe level. A narrow main lobe gives better ability to distinguish closely spaced frequencies, but higher side lobes can mask weak signals near strong ones.
  • Common windows and their characteristics:
    • Rectangular: Narrowest main lobe (best resolution) but highest side lobes (-13 dB). Use when you need to resolve closely spaced frequencies of similar amplitude.
    • Hamming: Good general-purpose choice. Side lobes around -43 dB with moderate main lobe widening.
    • Hanning (Hann): Similar to Hamming but with better side lobe roll-off. Very widely used.
    • Blackman: Lowest side lobes (~-58 dB) but widest main lobe. Best when you need to detect weak signals near strong ones.

Sample Rate Conversion

Changing the sampling rate of a digital signal requires careful handling to avoid aliasing or imaging artifacts. These operations are essential for interfacing systems with different sample rates and for efficient multi-rate processing.

Decimation and Interpolation

Decimation (downsampling by factor MM) reduces the sample rate by keeping every MM-th sample and discarding the rest.

  1. Apply a lowpass anti-aliasing filter with cutoff at ฯ€/M\pi/M to prevent high-frequency content from folding into the baseband.
  2. Discard every Mโˆ’1M-1 out of MM samples.

The filter must come before the downsampler. Skipping it causes aliasing that cannot be undone.

Interpolation (upsampling by factor LL) increases the sample rate by inserting Lโˆ’1L-1 zeros between each original sample.

  1. Insert Lโˆ’1L-1 zeros between each sample (this creates spectral images at multiples of the original sampling frequency).
  2. Apply a lowpass anti-imaging filter with cutoff at ฯ€/L\pi/L and gain LL to smooth the result.

Multi-rate processing combines both operations for rational sample rate conversion by a factor of L/ML/M. For example, converting 44.1 kHz audio to 48 kHz requires upsampling by 160 and downsampling by 147 (since 48000/44100=160/14748000/44100 = 160/147). In practice, polyphase filter structures make this efficient by avoiding computation on the zero-valued samples.

Compare: Decimation vs. Interpolation: decimation risks aliasing (filter before downsampling), while interpolation creates imaging artifacts (filter after upsampling). The lowpass filter always goes on the high-rate side of the operation.


Multi-Resolution Analysis

When signals have frequency content that changes over time, fixed-resolution Fourier analysis falls short. Wavelets provide adaptive time-frequency resolution, trading off temporal and spectral precision based on frequency.

Wavelet Transform

The Fourier transform tells you what frequencies are present in a signal, but not when they occur. The wavelet transform solves this by decomposing the signal using scaled and shifted versions of a localized "mother wavelet" ฯˆ(t)\psi(t):

W(a,b)=โˆซx(t)โ€‰1aฯˆโ€‰โฃ(tโˆ’ba)dtW(a, b) = \int x(t) \, \frac{1}{\sqrt{a}} \psi\!\left(\frac{t - b}{a}\right) dt

where aa controls the scale (inversely related to frequency) and bb controls the time shift.

  • Adaptive resolution is the key advantage. At high frequencies (small aa), the wavelet is narrow, giving fine time resolution. At low frequencies (large aa), the wavelet is wide, giving fine frequency resolution. This matches how most real signals behave: fast transients are high-frequency events that need precise timing, while slow oscillations need precise frequency identification.
  • Ideal for non-stationary signals where frequency content evolves over time, such as speech, music transients, ECG signals, and seismic data.
  • Enables efficient compression and denoising. Signal energy concentrates in a few large wavelet coefficients, while noise spreads across many small ones. Thresholding the small coefficients removes noise while preserving signal structure. JPEG 2000 uses the wavelet transform instead of DCT for this reason.

Compare: FFT vs. Wavelet Transform: FFT gives excellent frequency resolution but no time localization (you know what frequencies exist, not when). Wavelets sacrifice some frequency precision to gain time localization, making them superior for transient detection and signals with time-varying spectra. If the signal is stationary, FFT is simpler and sufficient. If the signal changes over time, reach for wavelets.


Quick Reference Table

ConceptBest Examples
Time-to-frequency conversionDFT, FFT, DCT
Computational efficiencyFFT, IIR filtering
Linear phase filteringFIR filtering
Sharp frequency response with few coefficientsIIR filtering
Signal comparison and delay estimationCorrelation (cross and auto)
Filtering implementationConvolution, FIR, IIR
Reducing spectral leakageWindowing (Hamming, Hanning, Blackman)
Sample rate conversionDecimation, Interpolation
Time-varying frequency analysisWavelet Transform
Compression applicationsDCT, Wavelet Transform

Self-Check Questions

  1. Both FFT and DCT convert signals to the frequency domain. What property makes DCT preferable for image compression, and why doesn't the standard DFT share this advantage?

  2. You need to design a filter that preserves the shape of a pulse waveform exactly. Should you choose FIR or IIR, and what specific property justifies your choice?

  3. Compare convolution and correlation: how do they differ mathematically, and what different applications does each serve?

  4. A student applies the DFT to a finite signal and observes unexpected high-frequency components that weren't in the original. What phenomenon is this, and which technique would reduce it?

  5. An ECG signal has a heart rate that varies over time. Why would wavelet analysis be more appropriate than a standard FFT, and what trade-off does the wavelet transform make to achieve this capability?