This is an example on how to design a filter in the analog domain, and then use the bilinear transform to transform it to the digital domain, while preserving the cut-off frequency.

We'll be using formulas derived on the Bilinear Transform and Butterworth Filters pages.

Design criteria

In this example, we'll design a digital fourth order Butterworth low-pass filter, with a sample frequency of $360\phantom{\rule{thickmathspace}{0ex}}\mathrm{H}\mathrm{z}$ and a cut-off frequency of $45\phantom{\rule{thickmathspace}{0ex}}\mathrm{H}\mathrm{z}$.

Frequency Pre-Warping

As discussed in the page on the Bilinear Transform, we have to apply pre-warping to the cut-off frequency before designing a filter. If we don't the cut-off frequency will shift to an incorrect frequency when we discretize the filter.

First, let's calculate the normalized digital frequency ${\omega }_{c,d}$, using the cut-off frequency ${f}_{c}$ and the sample frequency ${f}_{s}$: $\begin{array}{rl}{f}_{c}& =45\phantom{\rule{thickmathspace}{0ex}}\mathrm{H}\mathrm{z}\\ {f}_{s}& =360\phantom{\rule{thickmathspace}{0ex}}\mathrm{H}\mathrm{z}\\ {T}_{s}& =\frac{1}{{f}_{s}}\\ {\omega }_{c}& =2\pi {f}_{c}\\ & \approx 282.7\phantom{\rule{thickmathspace}{0ex}}\mathrm{r}\mathrm{a}\mathrm{d}\phantom{\rule{thickmathspace}{0ex}}{s}^{-1}\\ {\omega }_{c,d}& =\frac{{\omega }_{c}}{{f}_{s}}\\ & =\frac{\pi }{4}\frac{\mathrm{r}\mathrm{a}\mathrm{d}}{\mathrm{s}\mathrm{a}\mathrm{m}\mathrm{p}\mathrm{l}\mathrm{e}}\approx 0.7854\frac{\mathrm{r}\mathrm{a}\mathrm{d}}{\mathrm{s}\mathrm{a}\mathrm{m}\mathrm{p}\mathrm{l}\mathrm{e}}\end{array}$ The Nyquist-Shannon sampling theorem tells us that we can never sample frequencies higher than ${f}_{s}/2$ without losing information. This also means that the cut-off frequency can never be higher than half of the sample frequency. Or in other words, all normalized frequencies will be in the interval $\left[0,\pi \right]$.

Next, we'll use the pre-warping formula we derived in the page on the Bilinear Transform, in order to calculate the analog design frequency ${\omega }_{c,a}$: $\begin{array}{rl}{\omega }_{c,a}& =\frac{2}{{T}_{s}}\mathrm{tan}\left(\frac{{\omega }_{c,d}}{2}\right)\\ & =720\mathrm{tan}\left(\frac{\pi }{8}\right)\approx 298.2\phantom{\rule{thickmathspace}{0ex}}\mathrm{r}\mathrm{a}\mathrm{d}\phantom{\rule{thickmathspace}{0ex}}{s}^{-1}\end{array}$ Note that this frequency is relatively close to ${\omega }_{c}$, but it is not the same. The higher the cut-off frequency (relative to the sample frequency), the larger the error between ${\omega }_{c}$ and ${\omega }_{c,a}$.

Designing the Butterworth filter in the Analog Domain

Now that we know the pre-warped analog cut-off frequency, we can start designing the analog filter.
We'll use the formula for the Butterworth low-pass filter derived in the page on Butterworth Filters: $\begin{array}{}\text{(1)}& {H}_{4}\left({s}^{\prime }\right)=\frac{1}{{B}_{4}\left({s}^{\prime }\right)}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}\mathrm{w}\mathrm{h}\mathrm{e}\mathrm{r}\mathrm{e}\phantom{\rule{thickmathspace}{0ex}}{s}^{\prime }\triangleq \frac{s}{{\omega }_{c,a}}\end{array}$ ${B}_{4}\left({s}^{\prime }\right)=\left({s}^{\prime 2}-2\mathrm{cos}\left(2\pi \frac{4+1}{4\cdot 4}\right){s}^{\prime }+1\right)\left({s}^{\prime 2}-2\mathrm{cos}\left(2\pi \frac{2+4+1}{4\cdot 4}\right){s}^{\prime }+1\right)$ Defining these constants will make the calculations much easier: $\begin{array}{}\text{(2)}& \begin{array}{rl}\alpha & \triangleq -2\mathrm{cos}\left(\frac{5\pi }{8}\right)\\ & =\sqrt{2-\sqrt{2}}\end{array}\text{(3)}& \begin{array}{rl}\beta & \triangleq -2\mathrm{cos}\left(\frac{7\pi }{8}\right)\\ & =\sqrt{2+\sqrt{2}}\end{array}\end{array}$ $\begin{array}{}\text{(4)}& \begin{array}{rl}{B}_{4}\left({s}^{\prime }\right)& =\left({s}^{\prime 2}+\alpha {s}^{\prime }+1\right)\left({s}^{\prime 2}+\beta {s}^{\prime }+1\right)\\ & ={s}^{\prime 4}+{s}^{\prime 3}\left(\alpha +\beta \right)+{s}^{\prime 2}\left(\alpha \beta +2\right)+{s}^{\prime }\left(\alpha +\beta \right)+1\end{array}\end{array}$

Discretizing the Analog Filter

We can now just apply the Bilinear Transform to the analog transfer function, by substituting $s=\frac{2}{{T}_{s}}\frac{z-1}{z+1}$. Therefore: ${s}^{\prime }=\frac{2{f}_{s}}{{\omega }_{a,c}}\frac{z-1}{z+1}$ Again, we'll introduce a constant to simplify the expression: $\begin{array}{}\text{(5)}& \begin{array}{rl}\gamma & \triangleq \frac{2{f}_{s}}{{\omega }_{a,c}}=\frac{2{f}_{s}}{2{f}_{s}\mathrm{tan}\left(\frac{{\omega }_{c,d}}{2}\right)}=\mathrm{cot}\left(\pi \frac{{f}_{c}}{{f}_{s}}\right)\\ & =\mathrm{cot}\left(\frac{\pi }{8}\right)=1+\sqrt{2}\end{array}\end{array}$ $\begin{array}{}\text{(6)}& {s}^{\prime }=\gamma \frac{z-1}{z+1}\end{array}$ What follows is just rearranging the expression of ${B}_{4}\left({s}^{\prime }\right)$ from Equation $\text{???}$, using the substitution of Equation $\text{???}$.
Finally, we end up with an expression for the transfer function, using Equation $\text{???}$, and we can determine the coefficients using the constants defined in Equations $\text{2}$, $\text{3}$ & $\text{???}$. $\begin{array}{rl}{B}_{4}\left({s}^{\prime }\right)\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& {s}^{\prime 4}+{s}^{\prime 3}\left(\alpha +\beta \right)+{s}^{\prime 2}\left(\alpha \beta +2\right)+{s}^{\prime }\left(\alpha +\beta \right)+1\\ {B}_{4}\left(z\right)\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& {\gamma }^{4}\frac{\left(z-1{\right)}^{4}}{\left(z+1{\right)}^{4}}\\ & +{\gamma }^{3}\frac{\left(z-1{\right)}^{3}\left(z+1\right)}{\left(z+1{\right)}^{4}}\left(\alpha +\beta \right)\\ & +{\gamma }^{2}\frac{\left(z-1{\right)}^{2}\left(z+1{\right)}^{2}}{\left(z+1{\right)}^{4}}\left(\alpha \beta +2\right)\\ & +\gamma \frac{\left(z-1\right)\left(z+1{\right)}^{3}}{\left(z+1{\right)}^{4}}\left(\alpha +\beta \right)\\ & +\frac{\left(z+1{\right)}^{4}}{\left(z+1{\right)}^{4}}\\ =\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& \frac{1}{\left(z+1{\right)}^{4}}\left[\begin{array}{}& {\gamma }^{4}\left(z-1{\right)}^{4}\\ +& {\gamma }^{3}\left(z-1{\right)}^{3}\left(z+1\right)\left(\alpha +\beta \right)\\ +& {\gamma }^{2}\left(z-1{\right)}^{2}\left(z+1{\right)}^{2}\left(\alpha \beta +2\right)\\ +& \gamma \left(z-1\right)\left(z+1{\right)}^{3}\left(\alpha +\beta \right)\\ +& \left(z+1{\right)}^{4}\end{array}\right]\\ =\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& \frac{1}{\left(z+1{\right)}^{4}}\left[\begin{array}{}& {\gamma }^{4}& \left(& {z}^{4}& -& 4{z}^{3}& +& 6{z}^{2}& -& 4z& +& 1& \right)\\ +& {\gamma }^{3}& \left(& {z}^{4}& -& 2{z}^{3}& & & +& 2z& -& 1& \right)& \left(\alpha +\beta \right)\\ +& {\gamma }^{2}& \left(& {z}^{4}& & & -& 2{z}^{2}& & & +& 1& \right)& \left(\alpha \beta +2\right)\\ +& \gamma & \left(& {z}^{4}& +& 2{z}^{3}& & & -& 2z& -& 1& \right)& \left(\alpha +\beta \right)\\ +& & \left(& {z}^{4}& +& 4{z}^{3}& +& 6{z}^{2}& +& 4z& +& 1& \right)\end{array}\right]\\ =\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& \frac{1}{\left(z+1{\right)}^{4}}\left[\begin{array}{}& \left({\gamma }^{4}+{\gamma }^{3}\left(\alpha +\beta \right)+{\gamma }^{2}\left(\alpha \beta +2\right)+\gamma \left(\alpha +\beta \right)+1\right)& {z}^{4}\\ +& \left(-4{\gamma }^{4}-2{\gamma }^{3}\left(\alpha +\beta \right)+2\gamma \left(\alpha +\beta \right)+4\right)& {z}^{3}\\ +& \left(6{\gamma }^{4}-2{\gamma }^{2}\left(\alpha \beta +2\right)+6\right)& {z}^{2}\\ +& \left(-4{\gamma }^{4}+2{\gamma }^{3}\left(\alpha +\beta \right)-2\gamma \left(\alpha +\beta \right)+4\right)& z\\ +& \left({\gamma }^{4}-{\gamma }^{3}\left(\alpha +\beta \right)+{\gamma }^{2}\left(\alpha \beta +2\right)-\gamma \left(\alpha +\beta \right)+1\right)\end{array}\right]\\ {H}_{4}\left(z\right)\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& \frac{1}{{B}_{4}\left(z\right)}\\ =\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& \frac{\left(z+1{\right)}^{4}}{\left[\begin{array}{}& \left({\gamma }^{4}+{\gamma }^{3}\left(\alpha +\beta \right)+{\gamma }^{2}\left(\alpha \beta +2\right)+\gamma \left(\alpha +\beta \right)+1\right)& {z}^{4}\\ +& \left(-4{\gamma }^{4}-2{\gamma }^{3}\left(\alpha +\beta \right)+2\gamma \left(\alpha +\beta \right)+4\right)& {z}^{3}\\ +& \left(6{\gamma }^{4}-2{\gamma }^{2}\left(\alpha \beta +2\right)+6\right)& {z}^{2}\\ +& \left(-4{\gamma }^{4}+2{\gamma }^{3}\left(\alpha +\beta \right)-2\gamma \left(\alpha +\beta \right)+4\right)& z\\ +& \left({\gamma }^{4}-{\gamma }^{3}\left(\alpha +\beta \right)+{\gamma }^{2}\left(\alpha \beta +2\right)-\gamma \left(\alpha +\beta \right)+1\right)\end{array}\right]}\\ \triangleq \phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& \frac{{b}_{0}+{b}_{1}{z}^{-1}+{b}_{2}{z}^{-2}+{b}_{3}{z}^{-3}+{b}_{4}{z}^{-4}}{{a}_{0}+{a}_{1}{z}^{-1}+{a}_{2}{z}^{-2}+{a}_{3}{z}^{-3}+{a}_{4}{z}^{-4}}\end{array}$ $\begin{array}{rl}{b}_{0}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& 1\\ {b}_{1}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& 4\\ {b}_{2}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& 6\\ {b}_{3}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& 4\\ {b}_{4}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& 1\\ {a}_{0}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& {\gamma }^{4}+{\gamma }^{3}\left(\alpha +\beta \right)+{\gamma }^{2}\left(\alpha \beta +2\right)+\gamma \left(\alpha +\beta \right)+1\phantom{\rule{1em}{0ex}}\approx 97.95\\ {a}_{1}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& -4{\gamma }^{4}-2{\gamma }^{3}\left(\alpha +\beta \right)+2\gamma \left(\alpha +\beta \right)+4\phantom{\rule{1em}{0ex}}\approx -192.8\\ {a}_{2}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& 6{\gamma }^{4}-2{\gamma }^{2}\left(\alpha \beta +2\right)+6\phantom{\rule{1em}{0ex}}\approx 170.0\\ {a}_{3}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& -4{\gamma }^{4}+2{\gamma }^{3}\left(\alpha +\beta \right)-2\gamma \left(\alpha +\beta \right)+4\phantom{\rule{1em}{0ex}}\approx -70.96\\ {a}_{4}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& {\gamma }^{4}-{\gamma }^{3}\left(\alpha +\beta \right)+{\gamma }^{2}\left(\alpha \beta +2\right)-\gamma \left(\alpha +\beta \right)+1\phantom{\rule{1em}{0ex}}\approx 11.79\end{array}$

Frequency Response & Pole-Zero Map

We can check the filter's frequency response to make sure that we didn't make any mistakes. As mentioned in other pages, the frequency response of a digital system can be a obtained by evaluating the transfer function $H\left(z\right)$ along the unit circle ($z={e}^{j\omega }$). We'll plot the magnitude in decibels. $A\left(\omega \right)=20{\mathrm{log}}_{10}|H\left({e}^{j\omega }\right)|$ We can also plot the phase angle of the response: $\varphi \left(\omega \right)=\mathrm{\angle }H\left({e}^{j\omega }\right)$  You can see that the corner frequency lies around $45\phantom{\rule{thickmathspace}{0ex}}\mathrm{H}\mathrm{z}$. We can check this mathematically: $A\left({\omega }_{c,d}\right)=-3.01\mathrm{d}\mathrm{B}$

MATLAB & GNU Octave

If you have to design many different filters, you don't want to calculate them all by hand. Luckily, MATLAB and GNU Octave come with a command to calculate the coefficients of Butterworth filters.

f_s = 360;    % Sample frequency in Hz
f_c = 45;     % Cut-off frequency in Hz
order = 4;    % Order of the butterworth filter

omega_c = 2 * pi * f_c;       % Cut-off angular frequency
omega_c_d = omega_c / f_s;    % Normalized cut-off frequency (digital)

[b, a] = butter(order, omega_c_d / pi);    % Design the Butterworth filter
disp('a = '); disp(a);                     % Print the coefficients
disp('b = '); disp(b);
H = tf(b, a, 1 / f_s);                     % Create a transfer function
bode(H);                                   % Show the Bode plot

Note that MATLAB expects the normalized frequency as a number from 0 to 1, so we have to divide by $\pi$ before passing it to the butter function.

Python

A similar function is available in the SciPy signal package: butter.

from scipy.signal import butter, freqz, freqs
import matplotlib.pyplot as plt
from math import pi
import numpy as np

f_s = 360    # Sample frequency in Hz
f_c = 45     # Cut-off frequency in Hz
order = 4    # Order of the butterworth filter

omega_c = 2 * pi * f_c       # Cut-off angular frequency
omega_c_d = omega_c / f_s    # Normalized cut-off frequency (digital)

# Design the digital Butterworth filter
b, a = butter(order, omega_c_d / pi)
print('Coefficients')
print("b =", b)                           # Print the coefficients
print("a =", a)

w, H = freqz(b, a, 4096)                  # Calculate the frequency response
w *= f_s / (2 * pi)                       # Convert from rad/sample to Hz

# Plot the amplitude response
plt.subplot(2, 1, 1)
plt.suptitle('Bode Plot')
H_dB = 20 * np.log10(abs(H))              # Convert modulus of H to dB
plt.plot(w, H_dB)
plt.ylabel('Magnitude [dB]')
plt.xlim(0, f_s / 2)
plt.ylim(-80, 6)
plt.axvline(f_c, color='red')
plt.axhline(-3, linewidth=0.8, color='black', linestyle=':')

# Plot the phase response
plt.subplot(2, 1, 2)
phi = np.angle(H)                         # Argument of H
phi = np.unwrap(phi)                      # Remove discontinuities
phi *= 180 / pi                           # and convert to degrees
plt.plot(w, phi)
plt.xlabel('Frequency [Hz]')
plt.ylabel('Phase [°]')
plt.xlim(0, f_s / 2)
plt.ylim(-360, 0)
plt.yticks([-360, -270, -180, -90, 0])
plt.axvline(f_c, color='red')

plt.show() Comparison Between the Analog and Digital Filter

We can easily plot the Bode plots of the two filters on top of each other, in order to compare their properties.

from scipy.signal import butter, freqz, freqs
import matplotlib.pyplot as plt
from math import pi
import numpy as np

f_s = 360    # Sample frequency in Hz
f_c = 45     # Cut-off frequency in Hz
order = 4    # Order of the butterworth filter

omega_c = 2 * pi * f_c       # Cut-off angular frequency
omega_c_d = omega_c / f_s    # Normalized cut-off frequency (digital)

# Design the digital Butterworth filter
b_d, a_d = butter(order, omega_c_d / pi)
print('Digital Coefficients')
print("b =", b_d)                         # Print the coefficients
print("a =", a_d)

w, H_d = freqz(b_d, a_d, 4096)            # Calculate the frequency response
w *= f_s / (2 * pi)                       # Convert from rad/sample to Hz

# Design the analog Butterworth filter
b_a, a_a = butter(order, f_c, analog=True)
print('Analog Coefficients')
print("b =", b_a)                         # Print the coefficients
print("a =", a_a)

w, H_a = freqs(b_a, a_a, w)               # Calculate the frequency response

# Plot the amplitude response
plt.subplot(2, 1, 1)
plt.suptitle('Bode Plot')
H_d_dB = 20 * np.log10(abs(H_d))          # Convert modulus of H to dB
H_a_dB = 20 * np.log10(abs(H_a))
plt.plot(w, H_d_dB, color='blue', label='Digital')
plt.plot(w, H_a_dB, color='green', label='Analog')
plt.legend()
plt.ylabel('Magnitude [dB]')
plt.xlim(0, f_s / 2)
plt.ylim(-80, 6)
plt.axvline(f_c, color='red')
plt.axhline(-3, linewidth=0.8, color='black', linestyle=':')

# Plot the phase response
plt.subplot(2, 1, 2)
phi_d = np.angle(H_d)                     # Argument of H
phi_a = np.angle(H_a)
phi_d = np.unwrap(phi_d) * 180 / pi       # Remove discontinuities
phi_a = np.unwrap(phi_a) * 180 / pi       # and convert to degrees
plt.plot(w, phi_d, color='blue')
plt.plot(w, phi_a, color='green')
plt.xlabel('Frequency [Hz]')
plt.ylabel('Phase [°]')
plt.xlim(0, f_s / 2)
plt.ylim(-360, 0)
plt.yticks([-360, -270, -180, -90, 0])
plt.axvline(f_c, color='red')

plt.show() Discretization using Second Order Sections (SOS)

For higher order filters, small quantization errors on the transfer function coefficients can result in large errors on the pole and zero locations.
A solution is to factor the transfer function into second order factors or sections.

Recall from the previous sections, and define ${\alpha }_{k}$, ${H}_{2,k}$ and ${H}_{1}$ as follows:

Second Order Sections

We'll use the same technique as before to substitute ${s}^{\prime }$ into ${B}_{2,k}\left({s}^{\prime }\right)$ using the pre-warped bilinear transform relation $\text{8}$ to get the discrete-time Butterworth polynomial ${B}_{2,k}\left(z\right)$: $\begin{array}{rl}{B}_{2,k}\left({s}^{\prime }\right)\phantom{\rule{thickmathspace}{0ex}}\triangleq \phantom{\rule{thickmathspace}{0ex}}& {s}^{\prime 2}-{\alpha }_{k}{s}^{\prime }+1\\ {B}_{2,k}\left(z\right)\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}& {\gamma }^{2}{\left(\frac{z-1}{z+1}\right)}^{2}-{\alpha }_{k}\gamma \frac{z-1}{z+1}+1\\ \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}& {\gamma }^{2}\frac{{\left(z-1\right)}^{2}}{{\left(z+1\right)}^{2}}-{\alpha }_{k}\gamma \frac{\left(z-1\right)\left(z+1\right)}{{\left(z+1\right)}^{2}}+\frac{{\left(z+1\right)}^{2}}{{\left(z+1\right)}^{2}}\\ \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}& \frac{{\gamma }^{2}{\left(z-1\right)}^{2}-{\alpha }_{k}\gamma \left(z-1\right)\left(z+1\right)+{\left(z+1\right)}^{2}}{{\left(z+1\right)}^{2}}\\ \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}& \frac{\left({\gamma }^{2}-{\alpha }_{k}\gamma +1\right){z}^{2}-\left(2{\gamma }^{2}-2\right)z+\left({\gamma }^{2}+{\alpha }_{k}\gamma +1\right)}{{\left(z+1\right)}^{2}}\\ {H}_{2,k}\left(z\right)\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}& \frac{{z}^{2}+2z+1}{\left({\gamma }^{2}-{\alpha }_{k}\gamma +1\right){z}^{2}-\left(2{\gamma }^{2}-2\right)z+\left({\gamma }^{2}+{\alpha }_{k}\gamma +1\right)}\\ \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}& \frac{1+2{z}^{-1}+{z}^{-2}}{\left({\gamma }^{2}-{\alpha }_{k}\gamma +1\right)-\left(2{\gamma }^{2}-2\right){z}^{-1}+\left({\gamma }^{2}+{\alpha }_{k}\gamma +1\right){z}^{-2}}\end{array}$ The coefficients of the $k$-th factor of the discrete-time transfer function are thus: $\begin{array}{rl}{b}_{k,0}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& 1\\ {b}_{k,1}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& 2\\ {b}_{k,2}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& 1\\ {a}_{k,0}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& {\gamma }^{2}-{\alpha }_{k}\gamma +1\\ {a}_{k,1}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& 2\left(1-{\gamma }^{2}\right)\\ {a}_{k,2}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& {\gamma }^{2}+{\alpha }_{k}\gamma +1\end{array}$

First Order Section

For odd orders $n$, we need $\frac{n-1}{2}$ second order sections and a single first order section.

Again, we'll use the the pre-warped bilinear transform relation $\text{8}$: $\begin{array}{rl}{H}_{1}\left({s}^{\prime }\right)\phantom{\rule{thickmathspace}{0ex}}\triangleq \phantom{\rule{thickmathspace}{0ex}}& \frac{1}{{s}^{\prime }+1}\\ \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}& \frac{1}{\gamma \frac{z-1}{z+1}+1}\\ \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}& \frac{z+1}{\gamma \left(z-1\right)+\left(z+1\right)}\\ \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}& \frac{z+1}{\left(\gamma +1\right)z+\left(1-\gamma \right)}\\ \phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}& \frac{1+{z}^{-1}}{\left(\gamma +1\right)+\left(1-\gamma \right){z}^{-1}}\end{array}$ This gives us the coefficients of the first order factor of the discrete-time transfer function: $\begin{array}{rl}{b}_{0}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& 1\\ {b}_{1}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& 1\\ {a}_{0}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& \gamma +1\\ {a}_{1}\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}=\phantom{\rule{thickmathspace}{0ex}}\phantom{\rule{thickmathspace}{0ex}}& 1-\gamma \end{array}$