# Analog Filter Designs

These standard analog lowpass filters can be used as starting points for constructing digital filters. The filter descriptions are usually normalized, that is, the point of interest (such as the -3dB cutoff point) on the imaginary axis is always at $$i$$. If we want the point of interest to be at $$\omega_c$$ instead (we may be designing a filter with a particular cutoff for example), $$H(s)$$ can be scaled appropriately by replacing $$s$$ with $$s/\omega_c$$. This procedure is known as prewarping.

## Butterworth

The transfer function $$H(s)$$ of the $$N$$-pole Butterworth filter has $$N$$ poles evenly spaced around the left half of the unit circle. In other words, it has the form $$H(s) = 1/(s-p_1) \cdots (s-p_N)$$ where

$p_k = e^{i\frac{(2k+N-1)\pi}{2N}}$

The square of its frequency response is

$|H(i\omega)|^2 = \frac{1}{1 + \omega^{2N}}$

At a glance, we can see when $$\omega = 0$$ the gain is 1, when $$\omega = \infty$$ the gain is 0, and when $$\omega = 1$$, the gain is $$1 / \sqrt{2}$$. In some sense the Butterworth is the best possible smooth lowpass filter: it has a maximally flat frequency response at low frequencies since the first $$2N$$ derivatives of the frequency response take the value zero at $$\omega = 0$$.

## Chebyshev

By placing the poles on an ellipse instead of a circle, a lowpass filter with better rolloff can be achieved at the expense of allowing ripples in either the passband (Chebyshev Type I) or the stopband (Chebyshev Type 2).

## Elliptic

The Butterworth and Chebyshev filters are special kinds of elliptic filters (also known as Cauer filters). These involve zeros as well as poles, and give very high performance filters at the expense of ripples in both the passband and stopband. They are tedious to compute.

## Bessel

Bessel filters have maximally linear phase response at low frequencies, though their frequency response is not as good as the other three lowpass filters described here.

## Filter Transformations

Once a lowpass filter is obtained, it may be transformed into other kinds of filters by a simple variable substitution.

### Highpass

If $$s$$ is replaced with $$1/s$$ in $$H(s)$$, we see the value of $$H(i\omega)$$ is now what the value of $$H(1 / i \omega) = H(- i / \omega)$$ was in the lowpass filter, thus low frequencies will now be cut off, while high ones are let through. This gives us a highpass filter.

### Bandpass

Consider replacing $$s$$ with $$s + c^2 / s$$. Then $$H(i \omega)$$ will now have the value $$H(i{(\omega - c^2 / \omega)})$$. Note $$\omega - c^2 / \omega$$ is zero when $$\omega = c$$, tends to infinity as $$\omega \gt c$$ increases, and tends to minus infinity as $$\omega \lt c$$ tends to zero. Thus it is as if a lowpass filter has been placed on either side of $$c$$, which gives a bandpass filter.

To control the bandwidth of this filter, we replace $$s$$ by $$s/B$$ before applying the above transformation, where $$B$$ is the desired bandwidth. This will place the lowpass cutoff at $$B$$ (instead of 1). Then the positive solutions of $$\omega - c^2 / \omega = \pm B$$ are $$\omega = (\pm B + \sqrt{B^2 + 4 c^2})/2$$, and the difference between these two solution is precisely $$B$$.

### Bandstop

By transforming to a highpass filter, and then applying the bandpass transformation, we will have placed a highpass filter on either side of the desired frequency, creating a bandstop (or notch) filter.

In other words, we end up the reciprocal of the above function, that is, we replace $$s$$ by $$s / (s^2 + c^2)$$. As expected, this maps $$\omega$$ to the reciprocal of the previous case. $$i \omega / (i \omega + c^2)$$ takes the value 0 at zero, approaches infinity as $$\omega$$ approaches $$c$$ from below, approaches minus infinity as $$\omega$$ approaches $$c$$ from above, and lastly tends to zero as $$\omega$$ tends to infinity.

### Shelving, Peaking

If the output of a lowpass filter is added to the input then the low frequencies are boosted. The combined transfer function has the form $$H(s) = 1 + H_{LP}(s)$$ where $$H_{LP}$$ is the transfer function of the lowpass filter. Using this, an analog filter that performs shelving can be designed

Similarly, if the output of a bandpass filter added to the input signal then peaking occurs, that is, a certain band of frequencies is boosted.

## The Cookbook Filters

Robert Bristow-Johnson’s text file “Cookbook formulae for audio EQ biquad filter coefficients” describes how to construct various types of analog filters using at most two poles and zeroes, and also derives digital versions of each filter.

### Cookbook Lowpass

For a lowpass filter, the text file gives the transfer function

$H(s) = \frac{1}{s^2 + s/Q + 1}$

where $$Q$$ is a parameter called "resonance". (For $$Q = 1/\sqrt{2}$$ we get the 2-pole Butterworth filter. Increasing $$Q$$ moves the poles closer to the imaginary axis while keeping them on the unit circle.) The square of the frequency response of this filter is

$|H(i\omega)|^2 = \left|\frac{1}{1 - \omega^2 + i\omega/Q}\right|^2 = \frac{1}{\omega^4 - (2 - 1/Q^2) \omega^2 + 1}$

In particular, $$|H(i)| = Q$$.

### Cookbook Bandpass

The cookbook’s bandpass filters are transformed 1-pole Butterworth lowpass filters.

From above the 1-pole Butterworth filter with cutoff $$B$$ has transfer function

$H(s) = \frac{B}{s+B}$

Applying the above bandpass transformation gives a filter with transfer function

$H(s) = \frac{B s}{s^2 + B s + 1}$

The cookbook describes a bandpass filter with this transfer function (with $$Q = 1 / B$$), along with another with peak gain $$Q$$, which may be obtained by multiplication by $$Q$$. However, the cookbook measures the bandwidth in octaves, so we get

$BW = \lg \frac{\sqrt{B^2 + 4} + B}{2} - \lg \frac{\sqrt{B^2 + 4} - B}{2}$

where $$\lg$$ denotes log base 2. Thus

$2^{BW} = \frac{\sqrt{B^2 + 4} + B}{\sqrt{B^2 + 4} - B}$

Rearranging gives

$2^{BW} B^2 = (2^{BW}-1)^2$

Thus

$1/Q = B = 2^{BW/2} - 2^{-BW/2}$

which agrees with the formula given in the text file. Transforming to digital changes the bandwidth however: if the bandpass frequencies were $$\omega_1, \omega_2$$, after a bilinear transform they are proportional to $$\arctan(\omega_1), \arctan(\omega_2)$$.

Unfortunately it is not possible to obtain a closed formula that relates $$BW_a$$ and $$BW_d$$, but a first-order approximation described in a paper by Robert Bristow-Johnson. gives $$BW_a = BW_d \omega_0 / sin(\omega_0)$$, which is used in the text file.

### Cookbook Notch

The transfer function

$H(s) = \frac{1+s^2}{1+s/Q+s^2}$

can be derived from starting with a highpass 1-pole Butterworth filter with cutoff $$B$$

$H(s) = \frac{1}{B/s + 1}$

and applying the bandpass transformation. Equivalently, we may start from a lowpass 1-pole Butterworth filter and apply the bandstop transformation.

Ben Lynn blynn@cs.stanford.edu