Filters and signal processing · Part 24 of 36
Sampling, aliasing and digital filters
Expert 19 min
The Nyquist–Shannon theorem, aliasing, ADC resolution, the FFT, and FIR versus IIR digital filters.
What you will learn
- You can choose a sample rate and anti-aliasing filter using Nyquist.
- You can calculate ADC resolution and quantisation noise.
- You can compare FIR and IIR filters and read an FFT spectrum.
Before this: Active and higher-order filters
From continuous to discrete
An analogue-to-digital converter (ADC) measures a voltage at regular intervals — the sample rate f_s — and turns each measurement into a number. Two questions decide quality: how often (sample rate) and how finely (resolution).

Nyquist–Shannon
A signal can be reconstructed perfectly from its samples if it contains no frequencies at or above half the sample rate (the Nyquist frequency, f_s / 2). CD audio samples at 44.1 kHz to capture up to about 20 kHz, the limit of human hearing.
Aliasing
Frequencies above f_s / 2 don't disappear — they fold back and masquerade as lower frequencies. A 7 kHz tone sampled at 10 kHz shows up as 3 kHz (|7 − 10|). The wagon wheel turning backwards in films is the same effect. Once sampled, an alias is indistinguishable from a real 3 kHz signal. Hence the anti-aliasing low-pass filter before every ADC, and the practice of sampling well above twice the highest frequency of interest (oversampling) so a simple filter suffices.
Resolution and quantisation
An n-bit ADC divides its input range into 2ⁿ steps. A 12-bit ADC with a 3.3 V range has steps (1 LSB) of 3.3 V / 4096 ≈ 0.8 mV. Rounding to the nearest step adds quantisation noise; the ideal signal-to-noise ratio for a full-scale sine is about 6.02 × n + 1.76 dB — 74 dB for 12 bits, 98 dB for 16 bits. Real ADCs are worse: the ENOB (effective number of bits) in the datasheet tells you how many bits are actually useful.

The spectrum: FFT
The discrete Fourier transform turns N samples into N frequency bins, each f_s / N wide. The fast Fourier transform (FFT), popularised by Cooley and Tukey in 1965, computes it in O(N log N) instead of O(N²) — one of the most important algorithms ever (lesson "Big-O"). Practical points:
- Frequency resolution = f_s / N: 1 s of data gives 1 Hz bins.
- Multiply the data with a window (Hann, Blackman) to reduce spectral leakage when the signal isn't periodic in the record.
- Spectrum analysers, guitar tuners, vibration monitoring and audio codecs all live on FFTs.
Digital filters: FIR and IIR
A digital filter computes each output sample from input samples (and maybe previous outputs):
- FIR (finite impulse response): y[n] = Σ b_k × x[n − k]. A weighted moving average. Always stable; can have exactly linear phase (all frequencies delayed equally — no waveform distortion). Needs many taps for sharp filters. The simplest example is the moving average: average the last 8 samples.
- IIR (infinite impulse response): also uses previous outputs: y[n] = b₀x[n] + … − a₁y[n−1] − … . Very efficient — a second-order "biquad" section can do what an FIR needs 50 taps for — but phase is non-linear, and poor coefficient choices or rounding can make it unstable. Digital versions of Butterworth and Chebyshev filters are IIR.
A one-line IIR every embedded developer uses — the exponential moving average: y = y + α × (x − y) with 0 < α ≤ 1, the digital twin of the RC low-pass.
The modern balance
Fast, cheap ADCs and processors have moved much signal processing into software: software-defined radio, digital audio, sensor fusion. The analogue front end shrinks to protection, a gain stage and the anti-aliasing filter — but it can't be removed, because aliasing happens at the moment of sampling.
Key points
- Sample above twice the highest frequency (Nyquist); frequencies above f_s/2 alias down.
- An analogue anti-aliasing filter must precede the ADC; oversampling eases its design.
- n-bit ADC: 2ⁿ steps; ideal SNR ≈ 6.02n + 1.76 dB; check ENOB.
- FFT: N log N; bin width f_s/N; use windows against leakage.
- FIR: stable, linear phase, more taps. IIR: efficient, non-linear phase, watch stability.
Flashcards
- Question: What is the Nyquist frequency for f_s = 48 kHz?
- Answer: 24 kHz.
- Question: Where does a 9 kHz tone appear when sampled at 10 kHz?
- Answer: At 1 kHz (|9 − 10|).
- Question: What is the ideal SNR of a 16-bit ADC?
- Answer: About 98 dB (6.02 × 16 + 1.76).
- Question: Which digital filter type can have exactly linear phase?
- Answer: FIR.
Check yourself
Think about your answer, then open it. In the app the quiz is interactive, earns points and brings back what you missed.
A 12-bit ADC with a 5 V range: size of 1 LSB (in mV)?
Show the answer
1.22 mV (± 0.01 mV)
5 V / 4096 ≈ 1.22 mV.
Source: Smith, DSP Guide, ch. 3
A 13 kHz tone is sampled at 20 kHz. At what frequency does the alias appear (in kHz)?
Show the answer
7 kHz
|13 − 20| = 7 kHz.
Source: Oppenheim & Schafer, ch. 4
FFT of 2,048 samples at f_s = 8,192 Hz: bin width (in Hz)?
Show the answer
4 Hz
8,192 / 2,048 = 4 Hz.
Source: Smith, DSP Guide, ch. 8
Which properties belong to FIR filters?
- Always stable
- Can have exactly linear phase
- Use previous output values
- Need more taps than IIR for sharp responses
Show the answer
Always stable; Can have exactly linear phase; Need more taps than IIR for sharp responses
Using previous outputs is the defining feature of IIR filters.
Source: Smith, DSP Guide, ch. 14–19
Sources
- Discrete-Time Signal Processing (3rd ed.), Oppenheim & Schafer, Pearson, 2010
- The Scientist and Engineer’s Guide to Digital Signal Processing, Steven W. Smith, 1997 (free online)
- MIT OpenCourseWare 6.003 Signals and Systems, MIT, 2011
Facts checked on 2026-11-30. Skillgrove lessons are free learning material — no certificate and no accreditation.