|
DSP Master VCL
|
The resulting transfer function is returned in the state-space form with A,B,C,D variables.
function ChebyshevIIFilter(Order: integer; StopRipple: double; const CutoffFreq: array of double; FilterType: TFilterType; Analog: boolean; const A: TMtx; const B: TVec; const C: TVec; out d: double): double; overload;
Design a discrete highpass filter with transition band between 10..12 Hz, if the sampling frequency is 30 Hz. The stopband should have more then 50 dB attenuation and the passband should not have more then 0.2dB ripple.
This example does not actually filter data. It only designs the filter. To see how to actually apply the filter check the IirInit and IirInitBQ routines.
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,1); Order := ChebyshevIIOrder([10*2/30,12*2/30],0.2,50,ftHighpass,WcArray,false); ChebyshevIIFilter(Order,50,WcArray,ftHighpass,false,num,den); FrequencyResponse(num,den,Response,64); FreqFr := Ramp(Response.Length,mvDouble,0,1.0/Response.Length); //X axis DrawIt(FreqFr,20*Log10(Abs(Response))); end;
#include "MtxExpr.hpp" #include "MtxVecEdit.hpp" #include "MtxVecTee.hpp" #include "SignalUtils.hpp" #include "IirFilters.hpp" #include "LinearSystems.hpp" void __fastcall TForm41::BitBtn1Click(TObject *Sender) { sVector z,p, num, den, FreqFr, Response, WcArray; int Order; double k,Wc,Bw; WcArray.Size(1); Order = ChebyshevIIOrder(OPENARRAY(double,(10.0*2/30,12.0*2/30)),0.2,50,ftHighpass,WcArray.PValues1D(0),WcArray.Length-1,false); ChebyshevIIFilter(Order,50,WcArray.PValues1D(0),WcArray.Length-1,ftHighpass,false,num,den); FrequencyResponse(num,den,Response,64); FreqFr = Ramp(Response.Length,mvDouble,0,1.0/Response.Length); //X axis DrawIt(FreqFr,20*Log10(Abs(Response)),"Frequency response",false); }
|
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|