You are here: Symbol Reference > LinearSystems Namespace > Functions > LinearSystems.LowpassToBandstopZ Function
DSP Master VCL
ContentsIndex
PreviousUpNext
LinearSystems.LowpassToBandstopZ Function

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

Pascal
procedure LowpassToBandstopZ(const z: TVec; const p: TVec; var k: Double; Freq: Double; BW: Double; PrototypeFreq: Double); overload;

Elliptic bandstop 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. 

 

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

    procedure TForm1.Button1Click(Sender: TObject);
    var z,p,num,den,Response: Vector;
        Order: integer;
        k,Wc,w1,w2,BW: Double;
    begin
        Order := 4;//design a fourth order filter.
        EllipticAnalog(Order,0.1,30,z,p,k);  //design analog protype
        Bilinear(z,p,k,2); //bilinear with sampling frequency 2Hz.
        w1 := 0.2; //start of the stopband at 0.2Hz.
        w2 := 0.5; //stop of the stopband at 0.5Hz.
        Wc := Sqrt(w1*w2); //center frequency of the stopband
        BW := w2-w1;  //stopband width
        LowpassToBandstopZ(z,p,k,Wc,BW,BilinearUnwarp(1));
        ZeroPoleToTransferFun(num,den,z,p,k);

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

        FrequencyResponse(num,den,Response,64);
        DrawIt(Response);
    end;

 

    #include "MtxExpr.hpp"
    #include "MtxVecEdit.hpp"
    #include "MtxVecTee.hpp"
    #include "SignalUtils.hpp"
    #include "IirFilters.hpp"
    #include "LinearSystems.hpp"

    void __fastcall TForm1::BitBtn1Click(TObject *Sender)
    {
      sVector z, p, num, den, Response;
      int   Order;
      double k,Wc,w1,w2,BW;

      Order = 4;//design a fourth order filter.
      EllipticAnalog(Order,0.1,30,z,p,k);  //design analog protype
      Bilinear(z,p,k,2); //bilinear with sampling frequency 2Hz.
      w1 = 0.2; //start of the stopband at 0.2Hz.
      w2 = 0.5; //stop of the stopband at 0.5Hz.
      Wc = Sqrt(w1*w2); //center frequency of the stopband
      BW = w2 - w1;  //stopband width
      LowpassToBandstopZ(z, p, k, Wc, BW, BilinearUnwarp(1));
      ZeroPoleToTransferFun(num,den,z,p,k);

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

      FrequencyResponse(num,den,Response,64);
      DrawIt(Response);
    }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!