LinearSystems.Bilinear Method

Overload List

#SignatureDescription
1procedure Bilinear(const A: TMtx; const B: TVec; const C: TVec; var D: Double; FS: Double);Apply bilinear transform to a linear system represented in state-space form.
2procedure Bilinear(const z: TVec; const p: TVec; var k: Double; FS: Double; AddZeros: Boolean);Result = bilinear transformation

Overload 1: procedure Bilinear(const A: TMtx; const B: TVec; const C: TVec; var D: Double; FS: Double);

Apply bilinear transform to a linear system represented in state-space form.

#NameTypeDescription
1ATMtx
2BTVec
3CTVec
4DDouble
5FSDoublescalar

Result: stored in self (calling object)

See Also: LinearSystems.MatchedZTransform, LinearSystems.LowpassToLowpass, LinearSystems.LowpassToLowpassZ, LinearSystems.BilinearUnwarp, LinearSystems.BilinearPrewarp

Overload 2: procedure Bilinear(const z: TVec; const p: TVec; var k: Double; FS: Double; AddZeros: Boolean);

Compute bilinear transformation.

#NameTypeDescription
1zTVec
2pTVec
3kDouble
4FSDoublescalar
5AddZerosBoolean

Result: stored in self (calling object)

Remarks:

Apply bilinear transform to transfer function represented in zero-pole form. FS defines the sampling frequency. If z.Length < p.Length the routine will not add zeroes at -1 to match the number of poles unless AddZeros is True.

Bilinear transformation is defined with the mapping: s -> 2/T (1 - z^(-1))/(1 + z^(-1)), T = 1/FS Bilinear transform requires that the amplitude response of a continuous system is piecewise constant and can not be used to transform an analog differentiator to a digital filter (for example). Bilinear transform also does not preserve the impulse or the phase response [1].

References:

[1] Theory and application of digital signal processing, Lawrence R. Rabiner and Bernard Gold. Prentice-Hall, 1975

Examples
uses MtxExpr, Math387, MtxVec, MtxVecTee, MtxVecEdit,
LinearSystems, IirFilters, SignalUtils;

procedure TForm1.Button1Click(Sender: TObject);
var z,p,num,den, Response,b,c: Vector;
Order: integer;
k,Wc,d: Double;
A: Matrix;
begin
    Order := 5; //design a fifth order filter.

    EllipticAnalog(Order,0.2,40,z,p,k);  //design analog protype
    //passband ripple 0.2dB, stopband attenuation 40dB
    Bilinear(z,p,k,2);  //Sampling frequency  = 2
    Wc := 0.6; //request a cutoff at 0.6 Hz
    LowpassToLowpassZ(z,p,k,WC,BilinearUnwarp(1));  //frequency transformation in z-domain
    ZeroPoleToTransferFun(num,den,z,p,k);

    //Alternative 1:
    //      EllipticAnalog(Order,0.2,40,z,p,k);  //design analog protype
    //      Bilinear(z,p,k,2);  //Sampling frequency  = 2
    //      ZeroPoleToTransferFun(num,den,z,p,k);
    //      Wc := 0.6; //request a cutoff at 0.6 Hz
    //      LowpassToLowpassZ(num,den,WC,BilinearUnwarp(1));  //frequency transformation in z-domain

    //Alternative 2:
    //      EllipticAnalog(Order,0.2,40,z,p,k);  //design analog protype
    //      Wc := BilinearPrewarp(0.6); //request a cutoff at 0.6 Hz
    //      LowpassToLowpass(z,p,k,WC);  //frequency transformation in s-domain
    //      Bilinear(z,p,k,2);  //Sampling frequency  = 2
    //      ZeroPoleToTransferFun(num,den,z,p,k);

    //Alternative 3:
    //      EllipticAnalog(Order,0.2,40,z,p,k);  //design analog protype
    //      ZeroPoleToStateSpace(A,B,C,D,z,p,k);
    //      Wc := BilinearPrewarp(0.6); //request a cutoff at 0.6 Hz
    //      LowpassToLowpass(A,B,C,D,WC); //frequency transformation in s-domain
    //      Bilinear(A,B,C,D,2);
    //      StateSpaceToZeroPole(z,p,k,A,B,C,D);
    //      ZeroPoleToTransferFun(num,den,z,p,k);

    FrequencyResponse(num,den,Response,64); //zero padding set to 64
    DrawIt(Response);
end;