Design a highpass filter with at least 80 dB attenuation in the stopband and not more then 0.0001 ripple in the passband. Transition band is between 0.5 and 0.6 Hz. Sampling frequency is 2 Hz.
uses MtxExpr, Math387, MtxVec, SignalUtils, MtxVecTee, MtxVecEdit; procedure TForm1.Button1Click(Sender: TObject); var h,response: Vector; n: integer; FS,Ripple: double; begin Ripple := 0.0001; FS := 2; n := KaiserFirLength([0.5,0.6], Ripple, FS); n := EnsureRange(4, n, MaxFirLength); if not Odd(n) then Inc(n); //must be odd, if passband at FS/2 FirImpulse(H.Size(n), [0.5,0.6], ftHighpass,FS); //get impulse response Kaiser(H,KaiserBetaFir(Ripple)); //apply Kaiser window FrequencyResponse(H,nil,Response,8); //zero padd by 8x DrawIt(20*Log10(Abs(Response))); end;
#include "MtxExpr.hpp" #include "MtxVecEdit.hpp" #include "MtxVecTee.hpp" #include "SignalUtils.hpp" void __fastcall TForm41::BitBtn1Click(TObject *Sender) { sVector h,Response; int n; double FS = 2; double Ripple = 0.0001; n = KaiserFirLength(OPENARRAY(double,(0.5,0.6)), Ripple, FS); n = EnsureRange(4, n, MaxFirLength); if ((n%2) == 0) n++; //must be odd, if passband at FS/2 FirImpulse(h.Size(n), OPENARRAY(double,(0.5,0.6)), ftHighpass,FS); //get impulse response Kaiser(h,KaiserBetaFir(Ripple)); //apply Kaiser window FrequencyResponse(h,NULL,Response,8); //zero padd by 8x DrawIt(20*Log10(Abs(Response))); }
Copyright (c) 1999-2025 by Dew Research. All rights reserved.
|