SignalUtils::FirImpulse Function

Overload List

#SignatureDescription
1void FirImpulse(TVec *H, DewArray<double> W, TFilterType FilterType, double FS = 2);Design a FIR filter with rectangular window.
2void FirImpulse(TVec *H, DewArray<double> W, double WindowParam, TFilterType FilterType, TSignalWindowType WindowType, double Gain = 1, double FS = 2);Windowed-sinc FIR impulse response of a preset length.

Overload 1: void FirImpulse(TVec *H, DewArray<double> W, TFilterType FilterType, double FS = 2);

Design a FIR filter with rectangular window.

#NameTypeDescription
1HTVec *
2WDewArray<double>
3FilterTypeTFilterType
4FS = 2double
Remarks:

Compute a FIR impulse response filter (no window applied) and place the result in H. The transition regions are defined with the W array. There must be at least one (lowpass, highpass) and at most two (bandpass, bandstop) transition regions (2 or 4 elements). Filter type is defined with TFilterType. The length of the filter H.Length must be preset. Filters of even length (odd order), must have a stop band next to the nyquist (FS/2) frequency. 20*Log10(Ripple) is also the required attenuation of the stop band in decibel. FS is the sampling frequency.

Declared in Dew::Signal::Units::SignalUtils · Dew.Signal/Units.SignalUtils.h · Cross-compiler

Overload 2: void FirImpulse(TVec *H, DewArray<double> W, double WindowParam, TFilterType FilterType, TSignalWindowType WindowType, double Gain = 1, double FS = 2);

Windowed-sinc FIR impulse response of a preset length.

#NameTypeDescription
1HTVec *
2WDewArray<double>
3WindowParamdouble
4FilterTypeTFilterType
5WindowTypeTSignalWindowType
6Gain = 1double
7FS = 2double
Remarks:

Fills H (length preset by the caller) with the linear-phase windowed-sinc FIR taps for the given FilterType, then multiplies by the chosen window and by Gain. The ideal kernel about the centre alpha=(N-1)/2 is, e.g. for a lowpass with normalised cutoff omega_c = (W[0]+W[1])/ FS,

h[n] = (sinbig(pi omega_c (n-alpha)big))/(pi (n-alpha)), h[alpha] = omega_c

with highpass, bandpass and bandstop using the matching spectral complements, and the Hilbert/differentiator types using their odd-symmetric kernels. WindowType selects the taper (WindowParam carries its parameter, e.g. the Kaiser beta); wtRectangular leaves the raw sinc. H.FloatPrecision sets the working precision. Domain: H.Length must be at least 4 (an exception is raised otherwise); W must supply 1-2 band edges for lowpass/highpass and 2-4 for bandpass/bandstop; integrator types are rejected. FS is the sampling frequency (default 2, so cutoffs are in cycles per Nyquist). Finite input yields finite taps.

See Also: SignalUtils::FirFilter, SignalUtils::FirImpulse, SignalUtils::KaiserImpulse, OptimalFir::RemezImpulse, SignalUtils::FractionalKaiserImpulse, SignalUtils::FractionalFirImpulse
Declared in Dew::Signal::Units::SignalUtils · Dew.Signal/Units.SignalUtils.h · Cross-compiler