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

Convert a lowpass filter prototype in state space form to a bandstop filter.

Pascal
procedure LowpassToBandstop(const a: TMtx; const b: TVec; const c: TVec; var D: Double; CenterFreq: Double; Bw: Double); overload;

Design an analog bandstop filter, where the stopband is defined with Wl = 0.2 rad/sec, Wu = 0.6 rad/sec

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

    procedure TForm1.Button1Click(Sender: TObject);
    var z,p, num,den, FreqFr,Response: Vector;
        Order: integer;
        k,Wc,BW: Double;
    begin
        Order := 5; //design a fifth order filter.
        EllipticAnalog(Order,0.2,40,z,p,k);  //design analog protype
        Wc := Sqrt(0.2*0.6);
        BW := 0.6-0.2;
        LowpassToBandstop(z,p,k,WC,BW);  //frequency transformation in s-domain
        ZeroPoleToTransferFun(num,den,z,p,k);
        //Define the frequency grid (logarithmic)
        FreqFr.Length := 1000;
        LogRamp(FreqFr,-1,1); //between 0.1 (=10^(-1)) and 10 (=10^1) rad/sec
        FrequencyResponseS(num,den,FreqFr,Response); //Laplace
        DrawIt(Response); //Y axis linear, X axis logarithmic
    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, FreqFr,Response;
      int Order;
      double k,Wc,BW;

      Order = 5; //design a fifth order filter.
      EllipticAnalog(Order,0.2,40,z,p,k);  //design analog protype
      Wc = Sqrt(0.2*0.6);
      BW = 0.6-0.2;
      LowpassToBandstop(z,p,k,Wc,BW);  //frequency transformation in s-domain
      ZeroPoleToTransferFun(num,den,z,p,k);
      //Define the frequency grid (logarithmic)
      FreqFr.Length = 1000;
      LogRamp(FreqFr,-1,1); //between 0.1 (=10^(-1)) and 10 (=10^1) rad/sec
      FrequencyResponseS(num,den,FreqFr,Response); //Laplace
      DrawIt(Response); //Y axis linear, X axis logarithmic
    }

Copyright (c) 1999-2024 by Dew Research. All rights reserved.
What do you think about this topic? Send feedback!