# Bilinear transform

The bilinear transform in digital signal processing takes a transfer function H(s) in the analog domain (Laplace transform) and transforms it to the digital or z-domain, to obtain a function H(z). This transform preserves stability and is computed by substituting

``` s = (2 / T) * ((1 - z) / (1 + z))
```

where T is the sample time of the discrete system.

### Background

An analog filter is stable if the poles of its transfer function fall in the negative real half of the complex plane. A digital filter is stable if the poles of its transfer function fall inside the unit circle in the complex plane. The bilinear transform maps the negative real half of the complex plane to the interior of the unit circle. This way, filters designed in the the analog domain can be easily converted to the digital domain while preserving their stability.

### Example

As an example take a simple RC-filter. This filter has a transfer function

``` H(s) = 1/(1 + RC s)
```

If we wish to simulate this filter in a digital simulation, we can apply the bilinear transform by substituting for s the formula above, after some reworking, we get the following filter representation:

``` H(z) = (1 + z) / ((1 + 2RC/T) + (1 - 2RC/T) z)
```