The Journey to Digital Filter Design: High-pass Filter
Contents
1 Basic princeples
For a Butterworth high-pass filter, the squared frequency response is given by
$$
|H(\omega)|^2 = \frac{1}{1+(\frac{tan\frac{\omega_c}{2}}{\frac{\omega}{2}})^{2N}} \tag{1}.
$$
Using $tan\frac{\omega}{2}=\frac{1}{j}\frac{1-e^{-j\omega}}{1+e^{-j\omega}}$ and $z=e^{-j\omega}$, we have
$$
|H(z)|^2=\frac{(-1)^N(\frac{1-z^{-1}}{1+z^{-1}})^{2N}}{(-1)^N(\frac{1-z^{-1}}{1+z^{-1}})^{2N}+tan^{2N}\frac{\omega_c}{2}} \tag{2}.
$$
We know there $N$ repeated zeros $1$ of this transfer function, and the poles are little bit complicated. We first calculate
$q_k=\frac{1-z_k^{-1}}{1+z^{-1}}$.
$$
q_k=
\begin{cases}
&tan\frac{\omega_c}{2}e^{j\frac{2k+1}{2N}\pi}, \text{ for } N \text{ is even and }k=0, 1, 2, \cdots, 2N-1;\\
&tan\frac{\omega_c}{2}e^{j\frac{k}{N}\pi}, \text{ for } N \text{ is odd and }k=0, 1, 2, \cdots, 2N-1.
\end{cases} \tag{3},
$$
and $z_k=\frac{1+q_k}{1-q_k}$.
The transfer function of a Butterworth high-pass filter is given by
$$
H(z)= \frac{1}{2^N}\frac{\prod_{|z_k|<1}(1+z_k)(1-z^{-1})^N}{\prod_{|z_k|<1}(1-z_kz^{-1})} \tag{4}.
$$
2 Python code
Here, we give an example of implementing the Butterworth high-pass filter and compare it with that generated by scipy.
|
|
Author Geophydog
LastMod 2020-09-15