|
DSP Master VCL
|
Estimate the order of a Chebyshev type II IIR filter.
function ChebyshevIIOrder(const BEdges: array of double; PassRipple: double; StopRipple: double; FilterType: TFilterType; var CutoffFreq: array of double; Analog: boolean = False): integer;
Returns the order of the Chebyshev type II filter. Bedg array must contain the band edges of the transition region(s) sorted in ascending order. PassRipple defines the ripple of the passband and StopRipple defines the ripple of the stopband. The length of the CutoffFreq array must be equal to one half of the length of the BEdg array and must match the specified FilterType. The routine returns the estimated order as a result and fill's the CutoffFreq array. This array can then be passed to the ChebyshevIIFilter routine.
Design an analog bandpass filter with transition band between 1..3 and 6..9 rad/sec and with at least 50dB attenuation in the stopband and. The passband should not have more then 0.2dB ripple.
uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee, MtxVecEdit, IirFilters, LinearSystems; procedure TForm1.Button1Click(Sender: TObject); var z,p, num,den, FreqFr,Response: Vector; Order: integer; k,Bw,Wc: double; WcArray: TDoubleArray; //modified 3dB frequency begin SetLength(WcArray,2); Order := ChebyshevIIOrder([1,3,6,9],0.2,50,ftBandpass,WcArray,True); ChebyshevIIAnalog(Order,50,z,p,k); //design analog protype Wc := Sqrt(WcArray[0]*WcArray[1]); //modified 3dB frequency Bw := WcArray[1]-WcArray[0]; LowpassToBandpass(z,p,k,Wc,Bw); //frequency transformation in s-domain ZeroPoleToTransferFun(num,den,z,p,k); FreqFr.Length := 1000; //Define the frequency grid (logarithmic) 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, WcArray; int Order; double k,Wc,Bw; WcArray.Size(2); Order = ChebyshevIIOrder(OPENARRAY(double,(1,3,6,9)),0.2,50,ftBandpass,WcArray.PValues1D(0),WcArray.Length-1,true); ChebyshevIIAnalog(Order,50,z,p,k); //design analog protype Wc = Sqrt(WcArray[0] * WcArray[1]); //modified 3dB frequency Bw = WcArray[1] - WcArray[0]; LowpassToBandpass(z,p,k,Wc,Bw); //frequency transformation in s-domain ZeroPoleToTransferFun(num,den,z,p,k); FreqFr.Length = 1000; //Define the frequency grid (logarithmic) 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-2025 by Dew Research. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|