You are here: Symbol Reference > Dew.Signal Namespace > LinearSystems Class > LinearSystems Methods > Bilinear Method > Bilinear Method (TMtx, TVec, TVec, TSample, TSample)
Dew DSP for .NET
Contents
PreviousUpNext
LinearSystems.Bilinear Method (TMtx, TVec, TVec, TSample, TSample)

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

C#
public Bilinear(TMtx a, TVec b, TVec c, ref double d, double FS);

An analog lowpass filter is converted to z-domain by using the bilinear transform. The analog filter has a normalized cutoff frequency at 1 rad/sec. This frequency is mapped by the bilinear transformation to the value as returned by the function: BilinearUnwarp(1). To obtain the required cutoff frequency of an analog lowpass filter, which will map to a selected frequency in z-domain use the BilinearPrewarp routine.

  using Dew.Math;
  using Dew.Math.Editors;
  using Dew.Math.Units;
  using Dew.Signal;
  using Dew.Signal.Units;
  using Dew.Math.Tee;
  using Dew.Signal.Tee;

  private void button1_Click(object sender, EventArgs e)
  {
      Vector z = new Vector(0);
      Vector p = new Vector(0);
      Vector num = new Vector(0);
      Vector den = new Vector(0);
      Vector Response = new Vector(0);
      Vector b = new Vector(0);
      Vector c = new Vector(0);
      double k,Wc,d;
      Matrix A = new Matrix(0,0);
      double FS = 2;

      int Order = 5; //design a fifth order filter.

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

      SignalUtils.FrequencyResponse(num, den, Response, 64, false, TSignalWindowType.wtRectangular, 0); //zero padding set to 64
      TeeChart.DrawIt(Response, "Design method 0", false);

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

      SignalUtils.FrequencyResponse(num, den, Response, 64, false, TSignalWindowType.wtRectangular, 0); //zero padding set to 64
      TeeChart.DrawIt(Response, "Design method 1", false);

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

      SignalUtils.FrequencyResponse(num, den, Response, 64, false, TSignalWindowType.wtRectangular, 0); //zero padding set to 64
      TeeChart.DrawIt(Response, "Design method 2", false);

//Alternative 3:
      IIRFilters.EllipticAnalog(Order,0.2,40,z,p,out k);  //design analog protype
      LinearSystems.ZeroPoleToStateSpace(A,b,c,out d,z,p,k);
      Wc = LinearSystems.BilinearPrewarp(0.6,FS); //request a cutoff at 0.6 Hz
      LinearSystems.LowpassToLowpass(A,b,c,ref d,Wc); //frequency transformation in s-domain
      LinearSystems.Bilinear(A,b,c,ref d,2);
      LinearSystems.StateSpaceToZeroPole(z,p,out k,A,b,c,d);
      LinearSystems.ZeroPoleToTransferFun(num,den,z,p,k);

      SignalUtils.FrequencyResponse(num,den,Response,64,false,TSignalWindowType.wtRectangular,0); //zero padding set to 64
      TeeChart.DrawIt(Response,"Design method 3",false);
  }
What do you think about this topic? Send feedback!
Copyright (c) 1999-2010 by Dew Research. All rights reserved.