---
title: Sensitivity and component tolerances
heading: How much a filter moves when its parts are off by a percent, and which designs forgive it
eyebrow: C4 · Lesson 14 · Sensitivity and component tolerances
xp: 40
---

::: hook
Lesson 13 designed a Sallen-Key filter to land exactly on 1 kHz with Q = 0.707. Then you build it with 1% resistors and 5% capacitors, and every board comes out a little different. Will the corner move by 1%, by 5% or by more? It depends on the circuit, not just the parts: some designs spread a component's error thinly over the response, and others magnify it. A high-Q filter built the wrong way can turn a 1% gain error into a 15% change in its peak. **Sensitivity** puts a number on that, and it decides which topology to use, which parts need tight tolerances, and how many boards will pass test.
:::

::: play
- The Bode magnitude of an equal-component Sallen-Key low-pass with gain $K$, whose Q is $1/(3 - K)$. The dashed curve uses a gain 1% higher.
- At K = 2 (Q = 1) the two curves nearly overlap. Raise $K$ toward 3 and the peak grows, and so does the gap between the curves: the higher the Q, the more a tiny gain error matters.
:::

```sim plot
view: graph
x: f = 0.2..5 log
y: G = -30..30
slider: K = 1..2.9 step 0.01 = 2
plot: 20*log(K/sqrt((1 - f^2)^2 + (f*(3 - K))^2)) | label: gain K
plot: 20*log(1.01*K/sqrt((1 - f^2)^2 + (f*(3 - 1.01*K))^2)) | dashed | color: ch2 | label: gain 1% higher
readout: Q = 1/(3 - K) | digits: 3
readout: sensitivity of Q to K = K/(3 - K) | digits: 3
```

::: predict
## An equal-component Sallen-Key filter has gain K = 2.8 for Q = 5. Its gain resistors are off by enough to raise K by 1%. About how much does Q change?

- [ ] 1%
- [ ] 5%
- [x] About 15%
- [ ] It doesn't change

::: reveal
About 16%: K = 2.828 gives $Q = 1/(3 - 2.828)$ = 5.81. Q depends on $3 - K$, a small difference of two numbers near 3, so a small change in K is a large fractional change in $3 - K$. The sensitivity of Q to K here is $K/(3 - K)$ = 14, which predicts 14% for a 1% change; the exact answer is a little more because the change isn't infinitesimal.
:::
:::

::: nameit
## Sensitivity

The sensitivity of a quantity $y$ to a component $x$ is the fractional change in $y$ per fractional change in $x$:

$$S_x^y = \frac{\partial y/y}{\partial x/x} = \frac{\partial \ln y}{\partial \ln x}$$

If $y \propto x^n$, then $S_x^y = n$. For the unity-gain Sallen-Key low-pass of lesson 13, with $f_0 = 1/(2\pi\sqrt{R_1R_2C_1C_2})$ and $Q = \sqrt{R_1R_2C_1C_2}/(C_2(R_1 + R_2))$:

- $S^{f_0}$ = −½ for each of the four parts.
- $S_{C_1}^Q = \tfrac12$, $S_{C_2}^Q = -\tfrac12$, $S_{R_1}^Q = \tfrac12 - \frac{R_1}{R_1 + R_2}$, $S_{R_2}^Q = \tfrac12 - \frac{R_2}{R_1 + R_2}$.

With equal resistors, Q doesn't depend on them at all, and it depends on the capacitors only through their ratio.

## Adding up errors

To first order, the fractional change is the sum of sensitivities times fractional errors:

$$\frac{\Delta y}{y} \approx \sum_i S_{x_i}^y\frac{\Delta x_i}{x_i}$$

- **Worst case:** every part at the edge of its tolerance in the direction that hurts: $\sum |S_i|t_i$.
- **Statistical:** independent random errors with standard deviations $\sigma_i$ add as $\sqrt{\sum (S_i\sigma_i)^2}$. If a tolerance is about three standard deviations, the result is three standard deviations of $y$.
- **Monte Carlo:** draw random parts, compute the response, and count how many boards pass. It handles large errors and nonlinear dependence, which the first-order formulas don't.

## Designs that forgive

- Q set by a **difference** of nearly equal numbers, such as $3 - K$, has a large sensitivity. Q set by a **ratio** of like parts, such as $\sqrt{C_1/C_2}$, has a small one, and matched parts from one batch track each other.
- **Doubly terminated LC ladders** (lesson 11) are famously insensitive in the passband: they deliver the most power possible there, so any small change in an element, up or down, can only lower the transmission. To first order the change is zero. Many active filters imitate ladders for this reason.
- High-Q sections are the sensitive ones: tighten their parts, or split a high-order filter so that no section needs a very high Q.
:::

::: example
## A unity-gain Sallen-Key low-pass uses $R_1 = R_2$ = 4.7 kΩ, $C_1$ = 47 nF and $C_2$ = 22 nF, with 1% resistors and 5% capacitors. Find $f_0$ and Q, and their worst-case and statistical spreads.

::: solution
1. **Natural frequency.** With R = 4700 Ω and $\sqrt{C_1C_2} = \sqrt{47 \times 22}$ nF:
   $$\begin{aligned} f_0 &= \frac{1}{2\pi R\sqrt{C_1C_2}} \\ &= 1053\ \text{Hz} \end{aligned}$$
2. **Q.**
   $$\begin{aligned} Q &= \tfrac12\sqrt{47/22} \\ &= 0.731 \end{aligned}$$
3. **Spreads of $f_0$.** Every part has $S^{f_0} = -\tfrac12$, so the worst case and the statistical spread are
   $$\begin{aligned} \tfrac12(1 + 1 + 5 + 5) &= \pm 6\% \\ \tfrac12\sqrt{1 + 1 + 25 + 25} &= 3.6\% \end{aligned}$$
4. **Spreads of Q.** The resistors' Q sensitivities are zero with equal resistors, so Q's worst case and statistical spread are
   $$\begin{aligned} \tfrac12(5 + 5) &= \pm 5\% \\ \tfrac12\sqrt{50} &= 3.5\% \end{aligned}$$
5. **Where to spend.** The capacitors dominate both. Spending on 1% capacitors would cut the spreads to about 1%; better resistors would hardly help.

**Answer:** $f_0$ = 1053 Hz (±6% worst case, 3.6% statistical) and Q = 0.731 (±5% worst case, 3.5% statistical).
:::
:::

::: example
## The same filter type with $R_1$ = 10 kΩ and $R_2$ = 20 kΩ: what are Q's sensitivities to the resistors?

::: solution
1. **Sensitivity to $R_1$.**
   $$\begin{aligned} S_{R_1}^Q &= \frac12 - \frac{10}{30} \\ &= 0.167 \end{aligned}$$
2. **Sensitivity to $R_2$.**
   $$\begin{aligned} S_{R_2}^Q &= \frac12 - \frac{20}{30} \\ &= -0.167 \end{aligned}$$
3. **Why they're opposite.** They're equal and opposite: raising both resistors by the same fraction leaves Q alone, as it must, since scaling both resistors only rescales the frequency.
4. **What a 1% error does.** A 1% error in one of them moves Q by about 0.17%.
5. **The trade.** Unequal resistors cost a little Q accuracy, which is usually a fair trade for convenient capacitor values.

**Answer:** $S_{R_1}^Q$ = 0.167 and $S_{R_2}^Q$ = −0.167.
:::
:::

::: example
## An equal-component Sallen-Key filter with gain K has $Q = 1/(3 - K)$. Find $S_K^Q$, and the gain accuracy needed to hold Q = 5 within 5%.

::: solution
1. **Sensitivity to K.**
   $$\begin{aligned} S_K^Q &= \frac{K}{Q}\frac{\partial Q}{\partial K} \\ &= K(3 - K)\frac{1}{(3 - K)^2} \\ &= \frac{K}{3 - K} \\ &= KQ \end{aligned}$$
2. **At Q = 5.** K = 2.8, so
   $$S_K^Q = 14$$
3. **Gain accuracy.** A 5% limit on Q needs K within
   $$\frac{5}{14} = 0.36\%$$
4. **Resistor precision.** With $K = 1 + R_f/R_g$, the sensitivity of K to each gain-setting resistor is
   $$\begin{aligned} S^K &= \frac{K - 1}{K} \\ &= 0.64 \end{aligned}$$
   so the gain-setting resistors need to be about 0.1%.
5. **Other sections.** The same Q from a multiple-feedback or state-variable section, where Q is a ratio, needs nothing like that precision.

**Answer:** $S_K^Q = KQ$, which is 14 at Q = 5, so K must hold within 0.36%, which takes gain-setting resistors of about 0.1%.
:::
:::

::: check
given: t = 1 | 2 | 5
answer: 0.5*t
tolerance: 0.5%

## A filter's $f_0 = 1/(2\pi\sqrt{R_1R_2C_1C_2})$. One capacitor is {t}% high and every other part is exact. By about what percentage does $f_0$ fall?

::: right
Right. $S_C^{f_0} = -\tfrac12$, so $f_0$ falls by {answer}%.
:::

::: misses
- [t] $f_0$ goes as the inverse square root of each part: half the error.
- [t/4] Each part appears once under the square root: the sensitivity is −½.
- [any] Not yet. $f_0 \propto C^{-1/2}$, so $S = -\tfrac12$.
:::
:::

::: check
kind: parts
given: tr = 0.1 | 1 | 2; tc = 1 | 2 | 5 | 10

## A unity-gain Sallen-Key filter with equal resistors uses resistors of ±{tr}% and capacitors of ±{tc}%.

::: part
answer: 0.5*(2*tr + 2*tc)
tolerance: 0.5%

### What is the worst-case spread of $f_0$, in percent?

::: misses
- [2*tr + 2*tc] Each sensitivity is ½.
- [0.5*sqrt(2*tr^2 + 2*tc^2)] That's the statistical sum; the worst case adds magnitudes.
- [any] Not yet. $\sum |S_i|t_i$ with $|S_i| = \tfrac12$.
:::
:::

::: part
answer: 0.5*sqrt(2*tr^2 + 2*tc^2)
tolerance: 0.5%

### And the root-sum-square spread, in the same units?

::: misses
- [0.5*(2*tr + 2*tc)] That's the worst case. Square, add and take the root.
- [any] Not yet. $\sqrt{\sum(S_it_i)^2}$.
:::
:::

::: right
Right. The statistical spread is smaller because all four parts rarely err the same way at once.
:::
:::

::: check
given: R1 = 4.7 | 10 | 22; R2 = 15 | 33 | 47
answer: 0.5 - R1/(R1 + R2)
tolerance: 0.5%

## A unity-gain Sallen-Key low-pass has $R_1$ = {R1} kΩ and $R_2$ = {R2} kΩ. What is $S_{R_1}^Q$?

::: right
Right. $\tfrac12 - R_1/(R_1 + R_2)$ = {answer}.
:::

::: misses
- [0.5 - R2/(R1 + R2)] That's $S_{R_2}^Q$.
- [0.5] Include the $R_1 + R_2$ in Q's denominator.
- [any] Not yet. Differentiate $\ln Q = \tfrac12\ln R_1 - \ln(R_1 + R_2) + \ldots$ with respect to $\ln R_1$.
:::
:::

::: check
kind: parts
given: Q = 2 | 5 | 8 | 10; e = 0.5 | 1

## An equal-component Sallen-Key filter is designed for Q = {Q}, so $K = 3 - 1/Q$.

::: part
answer: (3 - 1/Q)*Q
tolerance: 0.5%

### What is $S_K^Q$?

::: misses
- [Q] It's $KQ$, not Q.
- [1/(3 - (3 - 1/Q))^2] That's $\partial Q/\partial K$ without the $K/Q$ scaling.
- [any] Not yet. $S_K^Q = K/(3 - K) = KQ$.
:::
:::

::: part
answer: (1/(3 - (3 - 1/Q)*(1 + e/100)) - Q)/Q*100
tolerance: 0.5%

### If K comes out {e}% high, by what percentage does Q actually change?

::: misses
- [(3 - 1/Q)*Q*e] That's the first-order estimate. Compute the new Q exactly.
- [any] Not yet. New $K$ = $K(1 + e/100)$, new $Q = 1/(3 - K_{new})$.
:::
:::

::: right
Right. The first-order estimate understates large changes, and near K = 3 a few percent can make the filter oscillate.
:::
:::

::: check
kind: choice

## Why is a doubly terminated LC ladder filter so insensitive to its element values in the passband?

- [x] It delivers the maximum available power there, so any change in an element, up or down, can only reduce the output: the first-order change is zero
- [ ] Inductors and capacitors are more accurate than resistors
- [ ] Its elements' errors always cancel in pairs
- [ ] Passive filters have no feedback, so nothing is amplified

::: right
Right. At a maximum, a function's slope is zero, so small changes in any element produce only second-order changes in the transmission, which is why active filters often imitate ladders.
:::

::: misses
- [2] LC parts are often less accurate than resistors. The insensitivity comes from the topology.
- [3] It's not cancellation between parts; each element on its own has zero first-order effect.
- [4] Lack of feedback isn't the reason; it's that the transmission sits at its maximum.
:::
:::

::: check
kind: derivation
vars: R1 = 1000..100000, R2 = 1000..100000

## Find the sensitivity of $Q = \sqrt{R_1R_2C_1C_2}/(C_2(R_1 + R_2))$ to $R_1$.

::: step
answer: 0.5/R1 - 1/(R1 + R2)

### Write $\ln Q = \tfrac12\ln R_1 + \tfrac12\ln R_2 - \ln(R_1 + R_2) + \ldots$ What is $\partial\ln Q/\partial R_1$?
:::

::: step
answer: 0.5 - R1/(R1 + R2)

### Multiply by $R_1$ to get $S_{R_1}^Q = \partial\ln Q/\partial\ln R_1$.
:::

::: right
Right. With equal resistors it's zero: Q doesn't care about the resistors, only about the capacitor ratio.
:::
:::

::: check
kind: python
given: tc = 1 | 2 | 5; seed = 1 | 2 | 3

## Run a Monte Carlo yield analysis. A unity-gain Sallen-Key filter has $R_1 = R_2$ = 4.7 kΩ (±1%), $C_1$ = 47 nF and $C_2$ = 22 nF (±`tc`% = {tc}%). Model each part as uniform within its tolerance, using `rng = numpy.random.default_rng(seed)` with `seed` = {seed} and drawing 100 000 boards in the order R1, R2, C1, C2 (each a vector from `rng.uniform(-1, 1, 100000)`). Set `f0_std` (the relative standard deviation of $f_0$, as a fraction), `q_std` (the same for Q) and `yield_pct`, the percentage of boards with $f_0$ within ±2% of the nominal 1053.08 Hz.

```python starter
import numpy as np
f0_std = 0.5 * np.sqrt(2 * 0.01**2 + 2 * (tc / 100)**2)
q_std = 0.5 * np.sqrt(2) * tc / 100
yield_pct = 100.0
print(f0_std, q_std, yield_pct)
```

```python solution
import numpy as np
rng = np.random.default_rng(seed)
n = 100000
R1 = 4700 * (1 + 0.01 * rng.uniform(-1, 1, n))
R2 = 4700 * (1 + 0.01 * rng.uniform(-1, 1, n))
C1 = 47e-9 * (1 + tc / 100 * rng.uniform(-1, 1, n))
C2 = 22e-9 * (1 + tc / 100 * rng.uniform(-1, 1, n))
f0 = 1 / (2 * np.pi * np.sqrt(R1 * R2 * C1 * C2))
Q = np.sqrt(R1 * R2 * C1 * C2) / (C2 * (R1 + R2))
f_nom = 1 / (2 * np.pi * 4700 * np.sqrt(47e-9 * 22e-9))
f0_std = np.std(f0) / np.mean(f0)
q_std = np.std(Q) / np.mean(Q)
yield_pct = 100 * np.mean(np.abs(f0 / f_nom - 1) <= 0.02)
print(f0_std, q_std, yield_pct)
```

```python tests
import numpy as np
rng = np.random.default_rng(seed)
n = 100000
u = [rng.uniform(-1, 1, n) for _ in range(4)]
R1, R2 = 4700 * (1 + 0.01 * u[0]), 4700 * (1 + 0.01 * u[1])
C1, C2 = 47e-9 * (1 + tc / 100 * u[2]), 22e-9 * (1 + tc / 100 * u[3])
f0 = 1 / (2 * np.pi * np.sqrt(R1 * R2 * C1 * C2))
Q = np.sqrt(R1 * R2 * C1 * C2) / (C2 * (R1 + R2))
fn = 1 / (2 * np.pi * 4700 * np.sqrt(47e-9 * 22e-9))
assert abs(f0_std - np.std(f0) / np.mean(f0)) < 1e-9, "f0_std should be the standard deviation of f0 over its mean, from the draws in the stated order."
assert abs(q_std - np.std(Q) / np.mean(Q)) < 1e-9, "q_std should be the relative standard deviation of Q."
assert abs(yield_pct - 100 * np.mean(np.abs(f0 / fn - 1) <= 0.02)) < 1e-9, "yield_pct should count boards with f0 within ±2% of nominal."
s = 0.5 * np.sqrt(2 * (0.01 / np.sqrt(3))**2 + 2 * (tc / 100 / np.sqrt(3))**2)
assert abs(f0_std / s - 1) < 0.05, "The simulated spread should match the first-order RSS estimate with σ = tolerance/√3 for uniform parts."
```

::: right
Right. A uniform part within ±t has a standard deviation of $t/\sqrt3$, and the first-order RSS formula with that σ matches the simulation closely. The yield is what the RSS spread predicts, and it's the number a production manager actually cares about.
:::
:::

::: explain
## Two second-order filters meet the same specification: one is an equal-component Sallen-Key with Q set by the amplifier's gain, the other is a unity-gain Sallen-Key with Q set by a capacitor ratio. For a Q of 8, which would you choose for a production board, and why?

::: model
The equal-component design sets $Q = 1/(3 - K)$, so Q = 8 needs K = 2.875, and Q's sensitivity to K is $KQ$ = 23: a 0.1% drift in a gain resistor moves Q by about 2%, and a few percent could make it oscillate. The unity-gain design sets Q by $\frac12\sqrt{C_1/C_2}$ with equal resistors, so Q's sensitivity to each capacitor is only ±½, and matched capacitors from one batch track each other. For Q = 8, though, it needs a capacitor ratio of 256, which is awkward and makes the stage sensitive to the op amp's limits, so a production design would more likely split the job or use a multiple-feedback or state-variable section, where Q is also a ratio of passive parts. The gain-set Sallen-Key is the one to avoid at high Q, because its Q is a small difference of large numbers.
:::
:::

::: practice

::: check
given: n = -2 | -1 | 0.5 | 2; t = 1 | 3
answer: n*t
tolerance: 0.5%

## A quantity is proportional to $x^{\given{n}}$. If $x$ rises by {t}%, by about what percentage does the quantity change?

::: misses
- [t] Multiply by the exponent: $S = n$.
- [any] $S_x^{x^n} = n$.
:::
:::

::: check
given: K = 1.5 | 2 | 2.5 | 2.9
answer: K/(3 - K)
tolerance: 0.5%

## An equal-component Sallen-Key filter has gain {K}. What is $S_K^Q$?

::: misses
- [1/(3 - K)] That's Q itself. The sensitivity is $KQ$.
- [any] $S_K^Q = K/(3 - K)$.
:::
:::
:::
