Second Order Butterworth Filter

Python. To grasp its fundamentals, I implemented the second order Butterworth filter for 500 Hz cutoff frequency by calculating its coefficients (pen and paper). Of course, it is so easy to use scipy butter function to get coefficients, particularly for higher orders. The Laplace transform and z-transform are mathematical ways of breaking an impulse response into sinusoids and decaying exponentials. This is done by expressing the system’s characteristics as one complex polynomial divided by another complex polynomial. Practical Infinite-Impulse-Response (IIR) filters are usually based upon analogue equivalents (Butterworth, Chebyshev, etc.), using a transformation known as the bilinear transformation which maps the s-plane poles and zeros of the analogue filter into the z-plane. The bilinear transform is a mathematical transformation from the z-domain to the s-domain where T is sampling period, fc is cutoff frequency (500Hz), and fs is sampling rate (44100Hz):

(1)   \begin{equation*} s = \frac{2}{T}\frac{(1-z^{-1})}{(1+z^{-1})} \end{equation*}


(2)   \begin{equation*} w_{c} = \frac{2}{T}tan\frac{\pi f_{_{c}}}{f_{s}} \end{equation*}


(3)   \begin{equation*} G(s) = \frac{w{_{c}}^{2}}{s^{2} + s\sqrt{2}w_{c} + w{_{c}}^{2}} \end{equation*}


(4)   \begin{equation*} G(z) = 0.00121\frac{{z^{2} + 2z + 1}}{{z^{2} - 1.89933z + 0.90416}} \end{equation*}


[1] Butterworth Filter, Wikipedia

[2] The Scientist and Engineer’s Guide to Digital Signal Processing, Steven W. Smith

[3] Design of Digital Filters (Lecture Series, Oxford University)