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

The function returns modified z (zeros), p (poles) and k (gain).

C#
public LowpassToBandPassZ(TVec z, TVec p, ref double k, double Freq, double BW, double PrototypeFreq);

Elliptic bandpass filter design. The cutoff frequency of a lowpass analog filter prototype transformed in to z domain is obtained with BilinearUnwarp method. The analog prototype filter has a normalized cutoff frequency at 1 rad/sec.

  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);
      double k, Wc;
      double FS = 2;
      int Order = 4; //design a fourth order filter.

      IIRFilters.EllipticAnalog(Order,0.1,30, z, p, out k);  //design analog protype
      LinearSystems.Bilinear(z, p, ref k, FS,true);
      double w1 = 0.2; //start of the passband at 0.2Hz.
      double w2 = 0.5; //stop of the passband at 0.5Hz.
      Wc = Math.Sqrt(w1*w2); //center frequency of the passband
      double BW = w2-w1;  //passband width
      LinearSystems.LowpassToBandPassZ(z, p, ref k, Wc, BW, LinearSystems.BilinearUnwarp(1,FS));
      LinearSystems.ZeroPoleToTransferFun(num,den, z, p, k);
      SignalUtils.FrequencyResponse(num, den, Response, 64, false, TSignalWindowType.wtRectangular, 0); //zero padding set to 64

  //Alternative:
  //            ...
  //            LinearSystems.ZeroPoleToTransferFun(num,den, z, p, k);
  //            LinearSystems.LowpassToBandPassZ(num,den, Wc, BW, LinearSystems.BilinearUnwarp(1,FS));

      TeeChart.DrawIt(Response, "Frequency response", false);
      //TeeChart.DrawIt(20 * MtxExpr.Log10(MtxExpr.Abs(Response)), "Magnitude", false);
      //TeeChart.DrawIt(MtxExpr.PhaseSpectrum(Response) * (180 / Math.PI), "Phase", false);
  }
What do you think about this topic? Send feedback!
Copyright (c) 1999-2010 by Dew Research. All rights reserved.