1
$\begingroup$

I would like to know how to apply a low pass filter (Butterworth) to a digital signal. So, I have some values of the signal, let's say $S(t)$. Those values are equally spaced in time. I have read the Wikipedia's article, but I do not understand how to apply the transfer function $H$. I assume that I have to use a Z-transformation and apply it on $S$ but I am not certain to know how to do that. By the way, the part Digital implementation of this article is not really detailed.

Can someone help me to understand those things ? I would really appreciate any answers :)

P.S. I know there are functions in Python (e.g. scipy) that handle that issue, but I would like to know the mathematics behind it.

Thanks.

$\endgroup$

2 Answers 2

0
$\begingroup$

What you need to do is find a digital filter $H(z)$ that behaves similar to the $H(s)$ of your Butterworth filter. That is, you need to read about IIR implementation.

There are several methods described in signal processing books about this subject. I recommend you to check for example "Essentials of Digital Signal Processing" from Lathi and Green.

Two of the most common methods are the "Impulse invariance" and the "Bilinear transform".

  • The impulse invariance requires you to find the impulse response $h(t)$ of your $H(s)$. After doing this, you sample it replacing $t$ by $nT$, to finally Z-transform your $h[n]$ into $H(z)$. Bare in mind that this method only works for band-limited filters (lowpass and bandpass) because of aliasing issues. You should determine an appropriate small enough T to avoid this.

  • The bilinear transform, on the other hand, consists on applying the following mapping of your variable $s$ into $z$:

    $s=\frac{2}{T}(\frac{z-1}{z+1})$

    This method has a drawback as well, which is the frequency warping, you can read about it here https://en.wikipedia.org/wiki/Bilinear_transform#Frequency_warping, but is in general easy to counter by pre-warping your original $H(s)$.

$\endgroup$
4
  • $\begingroup$ Great answer, thanks Axel Mancino. $\endgroup$
    – kakarotto
    Sep 11, 2019 at 9:34
  • $\begingroup$ Hmm I have another little question to ask. I do not know $T$, I mean I only have $S(t)$ for $t \in [1,2,...,m]$. So, is it possible to know $T$ ? $\endgroup$
    – kakarotto
    Sep 11, 2019 at 12:19
  • $\begingroup$ In both methods described the smaller the T, the better result you will obtain. For the first method, T will determine the sampling frequency and thus the repetitions of your original spectrum. Choose a big sampling frequency for smaller spectral superposition (this will depend on the order of your filter and on how much alias you tolerate). For the second method, non-linearity in the frequency mapping from analog to digital (warping) is a tangent function, which is almost lineal near the origin, so lowering T helps since the digital filter singularities get closer to zero. $\endgroup$ Sep 12, 2019 at 20:44
  • $\begingroup$ Thanks for explaining this. I did some researches and I found that $T$ is set so that the cut-off frequency of $H(s)$ is the same as $H(z)$. I will try to find $T$ with $N=3$ (order of my filter) which makes the cut-off frequency $\omega_c$ identical in both cases. It would be easy as I already know the formula of Butterworth filters. I would be glad to share you my findings. $\endgroup$
    – kakarotto
    Sep 13, 2019 at 11:46
1
$\begingroup$

In order to filter a discrete-time signal with a linear and time-invariant (LTI) filter, you need to implement a difference equation:

$$y[n]=-a_1y[n-1]-a_2y[n-2]-\ldots -a_Ny[n-N]+\\+b_0x[n]+b_1x[n-1]+\ldots+b_Nx[n-N]\tag{1}$$

where $x[n]$ is the input sequence, $y[n]$ is the output sequence, and $a_i$ and $b_i$ are the filter coefficients, which determine the properties of the filter (e.g., low pass or high pass, Butterworth or Chebyshev characteristic, etc.). The number of past values of $x[n]$ and $y[n]$ in $(1)$ is determined by the filter order $N$. The higher the order, the more degrees of freedom does the filter have, and the better it can approximate a desired response. In practice, very high orders are undesirable because of numerical problems.

The difference equation $(1)$ corresponds to a filter transfer function

$$H(z)=\frac{b_0+b_1z^{-1}+\ldots+b_Nz^{-N}}{1+a_1z^{-1}+\ldots+a_Nz^{-N}}\tag{2}$$

Some information on how to obtain the filter coefficients $a_i$ and $b_i$ is given in Axel Mancino's answer.

$\endgroup$
2
  • $\begingroup$ Thanks a lot for your answer, I am starting to understand things. Hope people will vote up your answer (I have no enough reputations to do so). $\endgroup$
    – kakarotto
    Sep 11, 2019 at 9:36
  • $\begingroup$ Hmm I have another little question to ask. I do not know $T$, I mean I only have $S(t)$ for $t\in[1,2,...,m]$. So, is it possible to know $T$ ? $\endgroup$
    – kakarotto
    Sep 11, 2019 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.