Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English version of the page.

# bilinear

Bilinear transformation method for analog-to-digital filter conversion

## Syntax

```[zd,pd,kd] = bilinear(z,p,k,fs) [zd,pd,kd] = bilinear(z,p,k,fs,fp) [numd,dend] = bilinear(num,den,fs) [numd,dend] = bilinear(num,den,fs,fp) [Ad,Bd,Cd,Dd] = bilinear(A,B,C,D,fs) [Ad,Bd,Cd,Dd] = bilinear(A,B,C,D,fs,fp) ```

## Description

The bilinear transformation is a mathematical mapping of variables. In digital filtering, it is a standard method of mapping the s or analog plane into the z or digital plane. It transforms analog filters, designed using classical filter design techniques, into their discrete equivalents.

The bilinear transformation maps the s-plane into the z-plane by

`${H\left(z\right)=H\left(s\right)|}_{s=2{f}_{s}\frac{z-1}{z+1}}.$`

This transformation maps the jΩ axis (from Ω = –∞ to +∞) repeatedly around the unit circle (ejw, from ω = –π to π) by

`$\omega =2{\mathrm{tan}}^{-1}\left(\frac{\Omega }{2{f}_{s}}\right).$`

`bilinear` can accept an optional parameter `Fp` that specifies prewarping. `fp`, in hertz, indicates a “match” frequency, that is, a frequency for which the frequency responses before and after mapping match exactly. In prewarped mode, the bilinear transformation maps the s-plane into the z-plane with

`${H\left(z\right)=H\left(s\right)|}_{s=\frac{2\pi {f}_{p}}{\mathrm{tan}\left(\pi \frac{{f}_{p}}{{f}_{s}}\right)}\frac{z-1}{z+1}}.$`

With the prewarping option, `bilinear` maps the jΩ axis (from Ω = –∞ to +∞) repeatedly around the unit circle (e, from ω = –π to π) by

`$\omega =2{\mathrm{tan}}^{-1}\left(\frac{\Omega \mathrm{tan}\left(\pi \frac{{f}_{p}}{{f}_{s}}\right)}{2\pi {f}_{p}}\right).$`

In prewarped mode, `bilinear` matches the frequency 2πfp (in radians per second) in the s-plane to the normalized frequency 2πfp/fs (in radians per second) in the z-plane.

The `bilinear` function works with three different linear system representations: zero-pole-gain, transfer function, and state-space form.

### Zero-Pole-Gain

`[zd,pd,kd] = bilinear(z,p,k,fs) ` and

`[zd,pd,kd] = bilinear(z,p,k,fs,fp) ` convert the s-domain transfer function specified by `z`, `p`, and `k` to a discrete equivalent. Inputs `z` and `p` are column vectors containing the zeros and poles, `k` is a scalar gain, and `fs` is the sampling frequency in hertz. `bilinear` returns the discrete equivalent in column vectors `zd` and `pd` and scalar `kd`. The optional match frequency, `fp` is in hertz and is used for prewarping.

### Transfer Function

`[numd,dend] = bilinear(num,den,fs)` and

`[numd,dend] = bilinear(num,den,fs,fp)` convert an s-domain transfer function given by `num` and `den` to a discrete equivalent. Row vectors `num` and `den` specify the coefficients of the numerator and denominator, respectively, in descending powers of s. Let B(s) be the numerator polynomial and A(s) be the denominator polynomial. The transfer function is:

`$\frac{B\left(s\right)}{A\left(s\right)}=\frac{B\left(1\right){s}^{n}+\cdots +B\left(n\right)s+B\left(n+1\right)}{A\left(1\right){s}^{m}+\cdots +A\left(m\right)s+A\left(m+1\right)}$`

`fs` is the sampling frequency in hertz. `bilinear` returns the discrete equivalent in row vectors `numd` and `dend` in descending powers of z (ascending powers of z–1). `fp` is the optional match frequency, in hertz, for prewarping.

### State-Space

`[Ad,Bd,Cd,Dd] = bilinear(A,B,C,D,fs)` and

`[Ad,Bd,Cd,Dd] = bilinear(A,B,C,D,fs,fp)` convert the continuous-time state-space system in matrices `A`, `B`, `C`, `D`

`$\begin{array}{l}\stackrel{˙}{x}=Ax+Bu\\ y=Cx+Du\end{array}$`

to the discrete-time system:

`fs` is the sampling frequency in hertz. `bilinear` returns the discrete equivalent in matrices `Ad`, `Bd`, `Cd`, `Dd`. The optional match frequency, `fp` is in hertz and is used for prewarping.

## Examples

collapse all

Design a 6th-order elliptic analog lowpass filter with 5 dB of ripple in the passband and a stopband 90 dB down. Use `bilinear` to transform it to a discrete-time IIR filter.

```Fs = 0.5; % Sampling frequency [z,p,k] = ellipap(6,5,90); % Lowpass filter prototype [num,den] = zp2tf(z,p,k); % Convert to transfer function form [numd,dend] = bilinear(num,den,Fs); % Analog to digital conversion fvtool(numd,dend) % Visualize the filter```

## Diagnostics

`bilinear` requires that the numerator order be no greater than the denominator order. If this is not the case, `bilinear` displays

```Numerator cannot be higher order than denominator. ```

For `bilinear` to distinguish between the zero-pole-gain and transfer function linear system formats, the first two input parameters must be vectors with the same orientation in these cases. If this is not the case, `bilinear` displays

```First two arguments must have the same orientation. ```

## Algorithms

collapse all

`bilinear` uses one of two algorithms depending on the format of the input linear system you supply. One algorithm works on the zero-pole-gain format and the other on the state-space format. For transfer function representations, `bilinear` converts to state-space form, performs the transformation, and converts the resulting state-space system back to transfer function form.

### Zero-Pole-Gain Algorithm

For a system in zero-pole-gain form, `bilinear` performs four steps:

1. If `fp` is present, it prewarps:

```fp = 2*pi*fp; fs = fp/tan(fp/fs/2) ```

otherwise, `fs = 2*fs`.

2. It strips any zeros at ±∞ using

```z = z(finite(z)); ```
3. It transforms the zeros, poles, and gain using

```pd = (1+p/fs)./(1-p/fs); % Do bilinear transformation zd = (1+z/fs)./(1-z/fs); kd = real(k*prod(fs-z)./prod(fs-p)); ```
4. It adds extra zeros at -1 so the resulting system has equivalent numerator and denominator order.

### State-Space Algorithm

For a system in state-space form, `bilinear` performs two steps:

1. If `fp` is present, let

`$\lambda =\frac{\pi {f}_{p}}{\mathrm{tan}\left(\pi {f}_{p}/{f}_{s}\right)}.$`

If `fp` is not present, let λ=fs.

2. Compute `Ad`, `Bd`, `Cd`, and `Dd` in terms of `A`, `B`, `C`, and `D` using

`$\begin{array}{l}{A}_{d}={\left(}^{I}\left(I+A\frac{1}{2\lambda }\right),\\ {B}_{d}=\frac{1}{\sqrt{\lambda }}{\left(}^{I}B,\\ {C}_{d}=\frac{1}{\sqrt{\lambda }}C{\left(}^{I},\\ {D}_{d}=\frac{1}{2\lambda }C{\left(}^{I}B+D.\end{array}$`

## References

[1] Parks, Thomas W., and C. Sidney Burrus. Digital Filter Design. New York: John Wiley & Sons, 1987, pp. 209–213.

[2] Oppenheim, Alan V., Ronald W. Schafer, and John R. Buck. Discrete-Time Signal Processing. Upper Saddle River, NJ: Prentice Hall, 1999, pp. 450–454.