---
title: Biquad and state-variable filters
heading: Filters whose frequency and Q are set by separate resistors
eyebrow: C6 · Lesson 27 · Biquad and state-variable filters
xp: 40
---

::: hook
The Sallen-Key and multiple-feedback filters of lesson 26 use one op amp per second-order section, and their frequency, Q and gain are tangled together: change one resistor and all three move, and a high-Q section becomes hypersensitive to its parts. Spend two more op amps and the tangle comes apart. A loop of two integrators and a summer realizes the second-order equation directly, gives low-pass, band-pass and high-pass outputs at once, and sets f₀ and Q with different resistors.

::: play
- The three curves are the low-pass, band-pass and high-pass outputs of one state-variable filter, against frequency.
- Change Q: the band-pass narrows and the low-pass and high-pass peak, but $f_0$ stays put.
- Change $f_0$: all three slide together, and the Q stays put. In this filter the two knobs are independent.
:::
:::

```sim plot
view: graph
x: f = 10..100k Hz log
y: g = -60..30 dB
slider: f0 = 100..10k = 1k Hz log
slider: Q = 0.5..20 = 2 log
plot: 20*log(1/sqrt((1 - (f/f0)^2)^2 + (f/f0/Q)^2)) | label: low-pass | samples: 400
plot: 20*log((f/f0/Q)/sqrt((1 - (f/f0)^2)^2 + (f/f0/Q)^2)) | color: ch2 | label: band-pass | samples: 400
plot: 20*log((f/f0)^2/sqrt((1 - (f/f0)^2)^2 + (f/f0/Q)^2)) | color: ch3 | label: high-pass | samples: 400
readout: low-pass peak, dB = 20*log(Q) | digits: 3
readout: band-pass bandwidth, Hz = f0/Q | digits: 3
```

::: predict
## In a state-variable filter, the resistor that sets Q is increased by 1%. What happens to the Q of a section designed for Q = 10?

- [x] It rises about 1%, to about 10.1
- [ ] It rises about 40%
- [ ] It doesn't change at all
- [ ] The filter oscillates

::: reveal
About 1%. In a state-variable or Tow-Thomas filter, Q is a resistor ratio, so its sensitivity to that resistor is 1. An equal-component Sallen-Key with Q = 10 needs a gain of 2.9, and a 1% rise in that gain takes Q to 14: the 40% answer belongs to the single-op-amp filter. That difference is why high-Q filters use two integrators.
:::
:::

::: nameit
## The two-integrator loop

The second-order low-pass equation can be written as $v = -\frac{1}{\omega_0^2}\ddot v - \frac{1}{\omega_0Q}\dot v + v_\text{in}$: the output is a sum of its own integrals. Build it literally: a summing amplifier makes the high-pass signal, an integrator turns it into the band-pass, a second integrator into the low-pass, and both are fed back to the summer. Each integrator has $\frac{1}{RC}$, so

$$f_0 = \frac{1}{2\pi RC}$$

and Q is set by how much band-pass signal is fed back: a resistor ratio of its own.

## Two common forms

- **State-variable (KHN):** summer, two integrators; outputs low-pass, band-pass and high-pass. Q and gain are set by the summer's resistors.
- **Tow-Thomas:** a damped (lossy) integrator, an ideal integrator and an inverter. With integrator resistors R and capacitors C, a damping resistor $R_Q$ across the first capacitor and an input resistor $R_\text{in}$:

$$f_0 = \frac{1}{2\pi RC}, \qquad Q = \frac{R_Q}{R}, \qquad |H_{BP}(f_0)| = \frac{R_Q}{R_\text{in}}, \qquad |H_{LP}(0)| = \frac{R}{R_\text{in}}.$$

## The responses

With $x = f/f_0$, the three outputs share one denominator $D = \sqrt{(1 - x^2)^2 + (x/Q)^2}$:

$$|H_{LP}| = \frac1D, \qquad |H_{BP}| = \frac{x/Q}{D}, \qquad |H_{HP}| = \frac{x^2}{D}.$$

## Higher orders

A higher-order filter is a cascade of second-order sections, each with its own $f_0$ and Q from a table. A fourth-order Butterworth uses two sections at the same $f_0$ with Q = 0.541 and 1.307. Tuning all sections together is as simple as ganging the integrator resistors.
:::

::: example
## Design a Tow-Thomas band-pass at 1 kHz with Q = 10 and unity gain at the center, using 10 nF capacitors.

::: solution
1. **Integrator resistors.** For both integrators,
   $$\begin{aligned} R &= \frac{1}{2\pi \times 1\ \text{kHz} \times 10\ \text{nF}} \\ &= 15.9\ \text{k}\Omega \end{aligned}$$
2. **Damping resistor.** Q = 10 needs
   $$\begin{aligned} R_Q &= 10R \\ &= 159\ \text{k}\Omega \end{aligned}$$
3. **Input resistor.** Unity gain at the center needs $R_\text{in} = R_Q$ = 159 kΩ.
4. **Bandwidth.**
   $$\frac{f_0}{Q} = 100\ \text{Hz}$$
5. **Retuning.** To retune it to 2 kHz, halve both integrator resistors; Q and the gain are untouched only if $R_Q$ is halved too, since Q is $R_Q/R$. Change only $R_Q$ to change Q.

**Answer:** R = 15.9 kΩ for both integrators, and $R_Q = R_\text{in}$ = 159 kΩ, giving a 100 Hz bandwidth.
:::
:::

::: example
## Build a fourth-order Butterworth low-pass at 1 kHz from two Tow-Thomas sections with the same integrators (R = 15.9 kΩ, C = 10 nF). What damping resistors?

::: solution
1. **Section Qs.**
   $$\begin{aligned} Q_1 &= \frac{1}{2\cos(\pi/8)} \\ &= 0.541 \end{aligned}$$
   and
   $$\begin{aligned} Q_2 &= \frac{1}{2\cos(3\pi/8)} \\ &= 1.307 \end{aligned}$$
2. **Damping resistors.** With $Q = \frac{R_Q}{R}$:
   $$\begin{aligned} R_{Q1} &= 0.541 \times 15.9\ \text{k}\Omega \\ &= 8.61\ \text{k}\Omega \\ R_{Q2} &= 1.307 \times 15.9\ \text{k}\Omega \\ &= 20.8\ \text{k}\Omega \end{aligned}$$
3. **Order of the sections.** Put the low-Q section first, so the high-Q section's peak doesn't overload the first stage on large inputs below the corner.

**Answer:** damping resistors of 8.61 kΩ and 20.8 kΩ, with the low-Q section first.
:::
:::

::: example
## Compare the sensitivity of Q to a 1% part error in a Tow-Thomas section with Q = 10 and in an equal-component Sallen-Key with Q = 10.

::: solution
1. **Tow-Thomas.** $Q = \frac{R_Q}{R}$, so a 1% change in $R_Q$ moves Q by 1%, to 10.1.
2. **Sallen-Key.** $Q = \frac{1}{3 - K}$ needs K = 2.9. A 1% rise in K, to 2.929, gives
   $$\begin{aligned} Q &= \frac{1}{0.071} \\ &= 14.1 \end{aligned}$$
   which is 41% higher.
3. **Why.** The Sallen-Key's Q depends on the small difference 3 − K, which magnifies errors by about 3Q; the two-integrator loop doesn't.

**Answer:** a 1% error moves the Tow-Thomas Q by 1%, to 10.1, and the Sallen-Key Q by 41%, to 14.1.
:::
:::

::: check
kind: parts
given: f = 0.1 | 1 | 10; C = 1 | 10 | 100; Q = 2 | 5 | 20

## A Tow-Thomas band-pass at {f} kHz with Q = {Q} uses {C} nF capacitors.

::: part
answer: 1/(2*pi*f*1000*C*1e-9)/1000
unit: kΩ
tolerance: 0.5%

### What integrator resistors?

::: misses
- [1/(f*1000*C*1e-9)/1000] Include the $2\pi$.
- [any] $R = \frac{1}{2\pi f_0C}$.
:::
:::

::: part
answer: Q/(2*pi*f*1000*C*1e-9)/1000
unit: kΩ
tolerance: 0.5%

### What damping resistor?

::: misses
- [1/(2*pi*f*1000*C*1e-9)/1000/Q] Q is $R_Q/R$, so $R_Q$ is Q times R.
- [any] $R_Q = QR$.
:::
:::
:::

::: check
kind: parts
given: f = 0.5 | 2; Q = 3 | 10; G = 1 | 2

## A Tow-Thomas section with R = 10 kΩ and Q = {Q} must have a center gain of {G}.

::: part
answer: Q*10/G
unit: kΩ
tolerance: 0.5%

### What input resistor?

::: misses
- [10/G] The center gain is $R_Q/R_\text{in}$.
- [any] $R_\text{in} = \frac{R_Q}{|H_{BP}(f_0)|}$.
:::
:::

::: part
answer: 10/(Q*10/G)
tolerance: 0.5%

### What's then its low-pass gain at DC?

::: misses
- [any] $\frac{R}{R_\text{in}}$.
:::
:::
:::

::: check
given: Q = 0.707 | 3 | 10; x = 0.5 | 2
answer: 20*log((x/Q)/sqrt((1 - x^2)^2 + (x/Q)^2))
unit: dB
tolerance: 0.5%

## A band-pass section has Q = {Q}. What's its gain at {x} times its center frequency, relative to the center?

::: right
Right. $\frac{x/Q}{\sqrt{(1 - x^2)^2 + (x/Q)^2}}$ = {answer}.
:::

::: misses
- [20*log(1/sqrt((1 - x^2)^2 + (x/Q)^2))] That's the low-pass output.
- [any] $|H_{BP}| = \frac{x/Q}{D}$.
:::
:::

::: check
kind: parts
given: K = 2 | 2.5 | 2.8 | 2.9; e = 0.5 | 1

## An equal-component Sallen-Key section has K = {K}, and K comes out {e}% high.

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

### What's its design Q?

::: misses
- [any] $\frac{1}{3 - K}$.
:::
:::

::: part
answer: (1/(3 - K*(1 + e/100))/(1/(3 - K)) - 1)*100
unit: %
tolerance: 1%

### By what percentage does its Q change?

::: misses
- [e] That would be a two-integrator section; here the error is magnified.
- [any] Recompute $\frac{1}{3 - K}$ with the larger K.
:::
:::
:::

::: check
given: N = 4 | 8 | 10; n = 1 | 2
answer: 1/(2*cos((2*n - 1)*pi/(2*N)))
tolerance: 0.5%

## An order-{N} Butterworth filter is built from second-order sections, numbered from the lowest Q. What Q does section {n} need?

::: right
Right. $\frac{1}{2\cos\theta}$ with θ = $\frac{(2n - 1)\pi}{2N}$: {answer}.
:::

::: misses
- [0.707] That's a second-order Butterworth's single section.
- [any] Section n's poles sit at θ = (2n − 1)·90°/N from the negative real axis, and Q = 1/(2 cos θ).
:::
:::

::: check
kind: choice

## A filter must be tuned over 100 Hz to 10 kHz without its Q changing. Which structure is easiest?

- [ ] An equal-component Sallen-Key, tuning its gain
- [x] A state-variable filter, tuning its two integrator resistors together
- [ ] A multiple-feedback band-pass, tuning one resistor
- [ ] A passive RLC, tuning the inductor

::: right
Right. $f_0$ depends only on the integrators' RC, and Q on a separate ratio.
:::

::: misses
- [1] The Sallen-Key's gain sets its Q, not its frequency.
- [3] In the MFB circuit, one resistor moves both $f_0$ and Q.
- [4] Tuning L moves Q too, and a 100:1 inductor range is impractical.
:::
:::

::: check
kind: derivation
vars: R = 1000..1000000, C = 0.000000001..0.000001, q = 1000..10000000, i = 1000..10000000

## A Tow-Thomas section has integrator resistors R, capacitors C, damping resistor q and input resistor i.

::: step
answer: 1/(2*pi*R*C)

### What's $f_0$?
:::

::: step
answer: q/R

### What's Q?
:::

::: step
answer: q/i

### What's the band-pass gain at $f_0$?
:::

::: step
answer: 1/(2*pi*R*C)/(q/R)

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

::: right
Right. Bandwidth $\frac{1}{2\pi qC}$ depends only on the damping resistor.
:::
:::

::: explain
## Why is a two-integrator filter's Q less sensitive to component errors than a single-op-amp Sallen-Key's?

::: model
In the two-integrator loop, Q is set by how much of the band-pass signal is fed back, which is a ratio of two resistors, so a 1% error in either changes Q by about 1%. In an equal-component Sallen-Key, Q is one over three minus the amplifier's gain. For a high Q, the gain has to sit just below three, so Q depends on a small difference between two nearly equal numbers, and any error in the gain is magnified by roughly three times Q. A Q of ten turns a 1% gain error into a 40% Q error. The extra op amps buy a structure where each parameter has its own resistor.
:::
:::

::: practice

::: check
given: f = 0.2 | 5; C = 2.2 | 47; Q = 4 | 15
answer: Q/(2*pi*f*1000*C*1e-9)/1000
unit: kΩ
tolerance: 0.5%

## Tow-Thomas at {f} kHz, Q = {Q}, C = {C} nF. Damping resistor?

::: misses
- [any] $R_Q = \frac{Q}{2\pi f_0C}$.
:::
:::

::: check
given: Q = 1 | 5; x = 0.25 | 3
answer: 20*log(1/sqrt((1 - x^2)^2 + (x/Q)^2))
unit: dB
tolerance: 0.5%

## Low-pass section, Q = {Q}, at {x} × $f_0$. Gain?

::: misses
- [any] $\frac{1}{\sqrt{(1 - x^2)^2 + (x/Q)^2}}$.
:::
:::
:::
