---
title: Noise bandwidth and anti-aliasing
heading: Filters as gatekeepers for noise and for sampling
eyebrow: C4 · Lesson 21 · Noise bandwidth and anti-aliasing
xp: 40
---

::: hook
Two jobs fall to filters in almost every measurement system. One is limiting noise: white noise has power at every frequency, so the only way to reduce it is to pass fewer frequencies, and the right measure of "how many" is the filter's noise bandwidth. The other is protecting a sampler: an analog-to-digital converter can't tell a 9 kHz tone from a 1 kHz one when it samples at 10 kHz, so anything above half the sampling rate must be removed before it gets there. Both turn a vague "filter it" into a number.
:::

::: play
- A converter samples at $f_s$. The sawtooth shows the frequency a tone appears at after sampling, against its true frequency: everything folds into the range 0 to $f_s/2$.
- Move the marker to a tone above $f_s/2$ and read where it lands. That alias can't be removed after sampling.
- The anti-aliasing filter (Butterworth, order $n$, corner $f_c$) must attenuate it first: the readout gives how much it does.
:::
:::

```sim plot
view: graph
x: f = 0..50 kHz
y: fa = 0..25 kHz
slider: fs = 5..50 step 1 = 10 kHz
slider: f0 = 0..50 step 0.1 = 9 kHz
slider: n = 1..8 step 1 = 4
slider: fc = 0.5..10 step 0.1 = 1 kHz
plot: abs(f - fs*round(f/fs)) | label: frequency after sampling | samples: 2000
marker: x = f0 | label: input tone
readout: it appears at, kHz = abs(f0 - fs*round(f0/fs)) | digits: 4
readout: filter attenuation at the input tone, dB = 10*log(1 + (f0/fc)^(2*n)) | digits: 3
```

::: predict
## A 10 kΩ resistor's noise is filtered by an RC low-pass with a 1 kHz corner. Through what bandwidth does its noise effectively pass?

- [ ] 1 kHz
- [x] About 1.57 kHz
- [ ] About 0.64 kHz
- [ ] All frequencies: noise can't be filtered

::: reveal
About 1.57 kHz. White noise passed by an RC low-pass carries the same total power as through an ideal brick-wall filter $\frac{\pi}{2}f_c$ wide, because the gentle roll-off lets a lot of noise through above the corner. That's the RC filter's equivalent noise bandwidth.
:::
:::

::: nameit
## Noise bandwidth

White noise has the same power in every hertz, so the noise a filter passes depends on its **equivalent noise bandwidth** (ENBW): the width of an ideal rectangular filter, with the same peak gain, that would pass the same noise power,

$$B_n = \int_0^\infty |H(f)|^2df \quad (\text{for peak gain } 1)$$

| Filter | ENBW |
|---|---|
| first-order RC | $\frac{\pi}{2}f_c = 1.57f_c$ |
| Butterworth, order $n$ | $f_c\frac{\pi/2n}{\sin(\pi/2n)}$: 1.11, 1.05, 1.03 $f_c$ for $n$ = 2, 3, 4 |

A resistor's thermal noise in that bandwidth is $\sqrt{4kTRB_n}$ (A11). For an RC filter the R cancels: the total noise on the capacitor is $\sqrt{kT/C}$, the same as for a sampling capacitor (C2.22).

## Aliasing

Sampling at $f_s$ can't distinguish a frequency $f$ from $f \pm kf_s$ (A10). A tone above the **Nyquist frequency** $f_s/2$ appears at

$$f_\text{alias} = |f - f_s\,\text{round}(f/f_s)|$$

and is indistinguishable from a real signal there. Once sampled, it can't be removed.

## Anti-aliasing filters

An analog filter before the converter must cut everything that would alias into the band you care about. For signals up to $f_\text{max}$, the first frequency that folds back into that band is $f_s - f_\text{max}$, and it must be attenuated below the converter's resolution: an ideal $N$-bit converter has an SNR of $6.02N + 1.76$ dB. The order follows from lesson 8. **Oversampling**, sampling much faster than $2f_\text{max}$, widens the gap and eases the filter, and is why audio converters sample at 64 or more times the signal rate and filter digitally.
:::

::: example
## A 10 kΩ resistor's noise passes an RC low-pass with a 1 kHz corner, at 300 K. How much noise comes out?

::: solution
1. **Noise bandwidth.**
   $$B_n = 1571\ \text{Hz}$$
2. **Noise voltage.** With $k = 1.381 \times 10^{-23}$ J/K,
   $$\begin{aligned} v_n &= \sqrt{4kTRB_n} \\ &= \sqrt{4k \times 300 \times 10^4 \times 1571} \\ &= 0.51\ \mu\text{V RMS} \end{aligned}$$
3. **Check: the capacitor.**
   $$\begin{aligned} C &= \frac{1}{2\pi \times 10^4 \times 1000} \\ &= 15.9\ \text{nF} \end{aligned}$$
4. **Check: kT/C.**
   $$\sqrt{kT/C} = 0.51\ \mu\text{V}$$

**Answer:** 0.51 µV RMS comes out.
:::
:::

::: example
## A 12-bit converter samples at 10 kHz, and the signal of interest goes up to 1 kHz. What Butterworth anti-aliasing filter, with its corner at 1 kHz, does it need?

::: solution
1. **First alias.** The first frequency to fold into 0 to 1 kHz is
   $$10 - 1 = 9\ \text{kHz}$$
2. **Attenuation needed.** It must be down
   $$6.02 \times 12 + 1.76 = 74\ \text{dB}$$
3. **Order.**
   $$\begin{aligned} n &\ge \frac{\log_{10}(10^{7.4} - 1)}{2\log_{10}9} \\ &= 3.88 \end{aligned}$$
   so 4.

**Answer:** a fourth-order Butterworth, so that 9 kHz is at least 74 dB down.
:::
:::

::: example
## A 10 kΩ resistor's noise at 300 K passes a second-order Butterworth low-pass with a 1 kHz corner. How much comes out, compared with a one-pole filter at the same corner?

::: solution
1. **Noise bandwidth.** For an n-th order Butterworth it's
   $$B_n = f_0\frac{\pi/2n}{\sin(\pi/2n)}$$
   which is 1.571f₀ for one pole and 1.111f₀ for two.
2. **Second-order noise.**
   $$\begin{aligned} v_n &= \sqrt{4kTR \times 1111\ \text{Hz}} \\ &= 429\ \text{nV} \end{aligned}$$
3. **One-pole noise.** The one-pole filter passes 510 nV.
4. **The limit.** Steeper filters approach a brick wall, whose noise bandwidth equals its corner: 407 nV.

**Answer:** 429 nV comes out of the second-order filter, against 510 nV for the one-pole.
:::
:::

::: check
given: fc = 0.1 | 1 | 20
answer: pi/2*fc
unit: kHz
tolerance: 0.5%

## What is the equivalent noise bandwidth of an RC low-pass with a {fc} kHz corner?

::: right
Right. $\frac{\pi}{2}f_c$ = {answer}.
:::

::: misses
- [fc] The roll-off above the corner lets extra noise through: $\frac{\pi}{2}f_c$.
- [any] Not yet. $B_n = 1.57f_c$.
:::
:::

::: check
given: n = 2 | 3 | 5; fc = 1 | 10
answer: fc*(pi/(2*n))/sin(pi/(2*n))
unit: kHz
tolerance: 0.5%

## What is the noise bandwidth of an order-{n} Butterworth low-pass with a {fc} kHz corner?

::: right
Right. $f_c\frac{\pi/2n}{\sin(\pi/2n)}$ = {answer}.
:::

::: misses
- [pi/2*fc] That's first order; sharper filters come closer to $f_c$.
- [any] Not yet. $f_c\frac{\pi/2n}{\sin(\pi/2n)}$.
:::
:::

::: check
given: C = 1 | 10 | 100; T = 300 | 77
answer: sqrt(1.381e-23*T/(C*1e-9))*1e6
unit: µV
tolerance: 0.5%

## What total thermal noise appears on the {C} nF capacitor of an RC low-pass at {T} K?

::: right
Right. $\sqrt{kT/C}$ = {answer}, whatever the resistor.
:::

::: misses
- [any] Not yet. The R cancels: $\sqrt{kT/C}$.
:::
:::

::: check
given: fs = 8 | 44.1; f = 5 | 7 | 30
answer: abs(f - fs*round(f/fs))
unit: kHz
tolerance: 0.5%

## A {f} kHz tone is sampled at {fs} kHz. At what frequency does it appear?

::: right
Right. $|f - f_s\,\text{round}(f/f_s)|$ = {answer}.
:::

::: misses
- [f - fs/2] Fold about multiples of $f_s$, not about $f_s/2$.
- [any] Not yet. Subtract the nearest multiple of $f_s$.
:::
:::

::: check
given: N = 8 | 12 | 16 | 24
answer: 6.02*N + 1.76
unit: dB
tolerance: 0.5%

## What is the SNR of an ideal {N}-bit converter?

::: right
Right. $6.02N + 1.76$ = {answer}.
:::

::: misses
- [6.02*N] Add 1.76 dB for a full-scale sine.
- [any] Not yet. $6.02N + 1.76$ dB.
:::
:::

::: check
given: fs = 20 | 48; fm = 2 | 4; N = 10 | 14
answer: ceil(log(10^((6.02*N + 1.76)/10) - 1)/(2*log((fs - fm)/fm)))
tolerance: 0.1%

## Signals up to {fm} kHz are sampled at {fs} kHz by an {N}-bit converter. What Butterworth order, cornered at {fm} kHz, keeps aliases below its resolution?

::: right
Right. Attenuate $f_s - f_\text{max}$ by $6.02N + 1.76$ dB: order {answer}.
:::

::: misses
- [any] Not yet. Find the attenuation needed at $f_s - f_\text{max}$, then the order.
:::
:::

::: check
kind: parts
given: n = 1 | 2 | 4; f = 1 | 10; R = 1 | 10

## A {R} kΩ resistor's noise at 300 K passes an n = {n} Butterworth low-pass at {f} kHz.

::: part
answer: f*1e3*(pi/(2*n))/sin(pi/(2*n))
unit: Hz
tolerance: 0.5%

### What's its noise bandwidth?

::: misses
- [any] $f_0\frac{\pi/2n}{\sin(\pi/2n)}$.
:::
:::

::: part
answer: sqrt(4*1.380649e-23*300*R*1e3*f*1e3*(pi/(2*n))/sin(pi/(2*n)))*1e9
unit: nV
tolerance: 0.5%

### What RMS noise comes out?

::: misses
- [any] $\sqrt{4kTRB_n}$.
:::
:::
:::

::: check
kind: derivation
vars: f = 1..1000000, R = 1..1000000, T = 1..400

## A resistor R at T through a one-pole low-pass with corner f.

::: step
answer: pi/2*f

### What's the noise bandwidth?
:::

::: step
answer: sqrt(4*1.380649e-23*T*R*pi/2*f)

### What RMS noise comes out?
:::

::: right
Right. The one-pole filter passes 57% more noise power than a brick wall at the same corner.
:::
:::

::: explain
## Why must an anti-aliasing filter come before the converter rather than after it?

::: model
Sampling folds every frequency above half the sampling rate down into the band below it, and once folded, a tone at 9 kHz sampled at 10 kHz becomes a set of numbers identical to those a genuine 1 kHz tone would produce. Nothing done to the samples afterward can tell the two apart, so no digital filter can remove the alias without also removing the real signal. The unwanted frequencies have to be removed while they're still at their true frequencies, which means an analog filter in front of the converter.
:::
:::

::: practice

::: check
given: fs = 10 | 44.1 | 96
answer: fs/2
unit: kHz
tolerance: 0.5%

## What is the Nyquist frequency for sampling at {fs} kHz?

::: misses
- [any] $f_s/2$.
:::
:::

::: check
given: R = 1 | 100; B = 1 | 20
answer: sqrt(4*1.381e-23*300*R*1000*B*1000)*1e6
unit: µV
tolerance: 0.5%

## What thermal noise does {R} kΩ produce in a {B} kHz noise bandwidth at 300 K?

::: misses
- [any] $\sqrt{4kTRB}$.
:::
:::

::: check
given: fs = 10 | 48; fm = 1 | 20
answer: fs - fm
unit: kHz
tolerance: 0.5%

## Signals go up to {fm} kHz and are sampled at {fs} kHz. What is the lowest input frequency that aliases into the signal band?

::: misses
- [any] $f_s - f_\text{max}$.
:::
:::
:::
