Bilinear transform (S→Z transformation)

Syntax
Hd=bilinear(Ha,Fp,DFormat)

Description
Convert an analog filter object to its digital equivalent using the Bilinear transform (S→Z transformation).

Pre-warping and scaling: In order to better match the analog transfer function, you may specify a single pre-warping frequency (matching frequency) via the Fp parameter. A further internal gain scaling operation is automatically performed in order to match the analog gain specification. If no prewarping is required, set Fp=0.

Hd: the bilinear method designs an IIR filter based on the analog filter object, Ha and places the transfer function (i.e. numerator and gain) into a digital filter object, Hd. The digital filter object can then be combined with other methods if so required. For a digital filter object, Hd, calling getnum(Hd), getden(Hd) and getgain(Hd) will extract the numerator, denominator and gain coefficients respectively – see below.

DFormat: allows you to specify the display format of resulting digital filter object.

symbolic Display a symbolic representation of the filter object. If the order > 10, the symbolic display option will be overridden and set to numeric.
numeric Display a matrix representation of the filter object
void Create a filter object, but do not display output

Examples

ClearH1;  // clear primary filter from cascade
interface wc={20,200,10,100}; // wc=1/(R*C);

Main()

// define analog RC filter
ANum={0,1};
ADen={1,wc};
AGain=wc;
Ha=analogtf(ANum,ADen,AGain,"symbolic");

Hd=bilinear(Ha,wc/Twopi,"symbolic");

Num = getnum(Hd); // define numerator coefficients
Den = getden(Hd); // define denominator coefficients
Gain = getgain(Hd); // define gain

Further Reading

A more detailed disucussion about converting legacy analog filters into their digital equivalents can be found in the blog.