# [SciPy-User] signal.bilinear question

Warren Weckesser warren.weckesser@enthought....
Mon Aug 30 13:36:20 CDT 2010

```Neal Becker wrote:
> Doc is pretty sketchy.
>

Yup.
> A, B = bilinear (a, b, fs)
>
> a, b are numerator, denominator, respectively?
>

No.  a is the denominator, b is the numerator.

> each are polynomials in _descending_ negative powers of s?
>

Yes.

> e.g.: a = a0 + a1 * s**-1 + a2 * s**-2 ...
>
> A, B are numerator, denominator, respectively?
>

No--the opposite.

> each are polynomials in descending negative powers of z?
>

Yes.

http://en.wikipedia.org/wiki/Bilinear_transform
shows that

1/(1 + (RC)s)

becomes

(1 + z^-1) / (1+2RC/T) + (1-2RC/T)*z^-1

With RC=3 and T=1, this means

1/(3*s + 1)

becomes

(1+z^-1) / (7 - 5*z^-1)

Here's that calculation with bilinear:

-----
In [32]: b = np.array([1.0])

In [33]: a = np.array([3.0, 1.0])

In [34]: B, A = bilinear(b, a)

In [35]: B, A
Out[35]: (array([ 0.14285714,  0.14285714]), array([ 1.        ,
-0.71428571]))

In [36]: 7*B, 7*A
Out[36]: (array([ 1.,  1.]), array([ 7., -5.]))
-----

Another example, from the bottom of the 5th page of these notes:
www.cs.man.ac.uk/~barry/mydocs/courses/EE4192/LFIL3.pdf

-----
In [55]: b = np.array([1.0])

In [56]: a = np.array([1.0/0.828**2, np.sqrt(2.)/0.828, 1.0])

In [57]: B, A = bilinear(b, a)

In [58]: B, A
Out[58]:
(array([ 0.09755701,  0.19511402,  0.09755701]),
array([ 1.        , -0.94326739,  0.33349543]))

In [59]: B/B[0]
Out[59]: array([ 1.,  2.,  1.])
-----

Warren

```