# Converting Analog Filter into Digital Filter, why Bilinear Transform?

What's the advantage of using the Bilinear Transform?

$$H_d(z) = H_c(s)\bigg|_{s=\frac{2}{T_s}\frac{z-1}{z+1}}$$

When you can just use this equation?

$$H_d(\omega) = H_c(\Omega)\bigg|_{\Omega=\omega/T_s}$$

In other words, why does bilinear transform exist? These two equations look almost the same to me...What are the tradeoffs between using one equation verses the other? Is there a case where you would use one verses the other?

$$\left . H_d(z) = H_c(s) \right |_{s = \frac{2}{T\,s}\frac{z-1}{z+1}}$$ describes a transfer function in the $$z$$ domain that you can easily translate into a difference equation and realize in software.

$$\left . H_d(\omega) = H_c(\Omega) \right |_{\Omega = \frac{\omega}{T\,s}}$$ describes an idealized frequency response that you would like $$H_d$$ to have when you are done realizing it physically in software.

They're different. Note particularly the "would like to have" -- any translation from the continuous-time domain to the discrete-time domain is an approximation; part of your job is to make sure it's both practically realizable and good enough.

Note that there are other ways of approximating $$H_c$$ with some $$H_d$$ -- the bilinear transform is just one way. It has a lot of currency because it's conceptually simple, and works pretty well. It also has a lot of currency because it's easy to do with pencil, paper, and a slide rule -- today, there's numerical optimization techniques that can get you closer to some desired filtering goal, for less work (but -- I can never remember the search terms :( )

• numerical optimization techniques to approximate a desired frequency response with a digital filter: The most famous one is probably the Remez exchange method. Jun 23, 2020 at 19:39
• And to add the least squares algorithm, which for most applications I deal with (optimizing overall SNR versus peak error) it usually ends up being the better choice. Jun 24, 2020 at 14:49

Why cannot we use:

$$H_d(\omega) = H_c(\Omega) |_{\Omega = \omega / T_s},$$

which means infinitely rolling an infinite continuous frequency axis over the finite discrete frequency axis (the unit circle).

What is the domain of $$\omega$$?

We could consider two cases:

• $$\omega \in (-\pi, \pi]$$ (which is used for discrete transfer functions), means that we'll only get a part of $$H_c(\Omega)$$, namely, the one for $$\Omega \in (-\pi/T_s, \pi / T_s]$$,
• $$\omega \in (-\infty, \infty)$$ (to cover the whole domain of $$H_c(\Omega)$$), means that $$H_d(\omega)$$ will get multiple values for each argument $$\omega$$ (because the continuous frequency axis is a line and the discrete frequency axis is a circle). Unless $$H_d(\Omega)$$ is periodic with a period corresponding to one circulation of the discrete frequency axis, which is a very rare and specific case.

So either we get a trimmed version of $$H_c(\Omega)$$ or an incorrectly defined (multi-valued) function.

So here's the thing. Any linear time-invariant filter has three essential elemental building blocks.

2. Scalers (multiply by a constant)
3. Something that discriminates w.r.t. frequency. That's the only way a filter can filter out some frequency vs some other frequency.

Both analog and digital filters do 1 and 2 in a straight-forward way.

The way that analog filters discriminate frequency is with devices that differentiate or integrate w.r.t. time. Differentiating a higher frequency sinusoid results in a larger amplitude than for a lower frequency.

The way that digital filters discriminate frequency is with devices that delay a signal w.r.t. time.

Both domains have their equivalent transforms, the Laplace Transform for analog in which the differentiator is an operator that is multiplication by $$s$$ (the integrator is $$s^{-1}$$) and the Z Transform for digital in which the the delay operator is multiplication by $$z^{-1}$$.

Now in both domains, the delay of the same unit of time (which is the sampling period, $$T$$) is

$$z^{-1} = e^{-sT}$$

or

$$z = e^{sT}$$

or

$$s = \frac{1}{T} \ln(z)$$

Now if digital filters had an operator that could do the $$\ln(z)$$ operation, you could emulate an analog filter design exactly, whatever analog $$s$$-plane transfer function $$H_\mathrm{a}(s)$$ that is your model, you could make a $$z$$-plane digital filter $$H(z)$$ follow it exactly with

$$H(z) = H_\mathrm{a}(s) \bigg|_{s=\frac{1}{T}\ln(z)}$$

but digital filters don't have that $$\ln(z)$$ operation. They have the $$z^{-1}$$ operation. But we know we can construct digital filters with adders, scalers, delay elements. We have already learned that any rational function

$$H(z) = \frac{b_0 + b_1 z^{-1} + \cdots + b_M z^{-M}}{a_0 + a_1 z^{-1} + \cdots + a_N z^{-N}}$$

So we can't do $$\ln(z)$$ exactly. But we can approximate it.

$$\ln(z) = 2\left[\left({z-1\over z+1}\right)+ {1\over3} \left({z-1\over z+1}\right)^3 + {1\over5} \left({z-1\over z+1}\right)^5+ \cdots\right]$$

The bilinear transform approximates that infinite series by keeping just the first-order term:

$$\ln(z) \approx 2 \cdot \frac{z-1}{z+1} = 2 \cdot \frac{1-z^{-1}}{1+z^{-1}}$$

So then the substitution above becomes

$$H(z) = H_\mathrm{a}(s) \bigg|_{ s \leftarrow \frac{2}{T}\frac{1-z^{-1}}{1+z^{-1}} }$$

If $$H_\mathrm{a}(s)$$ is a rational function with order $$N$$ (let's say that $$M \le N$$) then $$H(z)$$ must also be a rational function of the same order.

So that's the root motivation of the bilinear transform. It's about how to implement or approximate $$\ln(z)$$.

Now there are some neat mathematical features using that substitution because in analog filters, to do frequency response we make this $$s = j \Omega$$ substitution which means we evaluate $$H_\mathrm{a}(s)$$ on the (imaginary) $$j \Omega$$ axis. With digital filters we say $$z=e^{j\omega}$$ for frequency response and evaluate $$H(z)$$ on the $$|z|=1$$ unit circle.

So the $$z=e^{sT}$$ function maps the $$j \Omega$$ axis in the $$s$$-plane to the unit circle $$z=e^{j \omega}$$ unit circle where

$$\omega = \Omega T$$

But so also does the bilinear transform. You can show that:

$$z = \frac{1+\frac{sT}{2}}{1-\frac{sT}{2}}$$

which is the inverse bilinear transform, also maps the $$j \Omega$$ axis in the $$s$$-plane to the unit circle $$z=e^{j \omega}$$ unit circle but to a different spot on the unit circle.