OptimalFir::RemezFirLength Function

int RemezFirLength(const DewArray<double> &W, double Ripple, TFilterType FilterType, double FS = 2);

Estimate the number of taps of an optimal equiripple FIR filter.

#NameTypeDescription
1Wconst DewArray<double> &Transition-band edge frequencies (2 or 4 values), relative to FS.
2RippledoubleMaximum allowed linear passband ripple; also sets the stopband attenuation as 20 log_(10)(Ripple). Must be positive.
3FilterTypeTFilterTypeFilter class (lowpass, highpass, bandpass, bandstop, ...).
4FS = 2doubleSampling frequency used to normalise W; default 2.

Returns: The estimated filter length (>= 3, <= MaxFirLength).

Remarks:

Returns an estimate of the filter length (number of impulse-response coefficients) needed for a Parks-McClellan design that achieves at most Ripple in the passband over the transition geometry in W. The requested stopband attenuation in dB is taken to be A_(stop) = 20 log_(10)(Ripple) , and the length grows as the transition band narrows and as Ripple decreases. The W array holds two (lowpass/highpass) or four (bandpass/bandstop) edge frequencies giving the start and stop of each transition band, expressed relative to FS. The result is clamped to at least 3 and never exceeds the MaxFirLength global. For filter types whose response is non-zero at the Nyquist frequency the length is forced odd.

Note: this is a simplified front end to RemezLength (which additionally fills the per-band error weights).

See Also: OptimalFir::RemezLength, OptimalFir::RemezImpulse, KaiserFirLength, KaiserImpulse, FirImpulse
Declared in Dew::Signal::Units::OptimalFir · Dew.Signal/Units.OptimalFIR.h · Cross-compiler