OptimalFir::RemezLength Function

int RemezLength(const DewArray<double> &bands, const DewArray<double> &gains, const DewArray<double> &Ripple, TVec *Weights, double FS = 2);

Estimate the length of an optimal equiripple FIR filter and build its error-weight vector.

#NameTypeDescription
1bandsconst DewArray<double> &Band-edge frequencies in ascending pairs, relative to FS.
2gainsconst DewArray<double> &Desired gain for each band (one per band).
3Rippleconst DewArray<double> &Maximum allowed ripple for each band (one per band; positive).
4WeightsTVec *Destination vector; receives one normalised error weight per band.
5FS = 2doubleSampling frequency used to normalise bands; default 2.

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

Remarks:

Estimates the number of taps for a Parks-McClellan (remez) design over the given multi-band specification, and as a side effect fills Weights with one error weight per band, normalised so the smallest required ripple maps to weight 1 and tighter-ripple bands get proportionally larger weights: w_i prop (max_j ripple_j)/ripple_i . The length estimate uses the worst-case transition band and is clamped to at least 3; when the highest-frequency band is a passband the length is forced odd. Pass the returned length to remez as the impulse-response size, and pass Weights as its weight array.

Domain: bands holds the band edges in pairs (length 2* the number of bands), one gain and one ripple per band, all relative to FS; gains, ripple and the number of bands must be consistent or an exception is raised.

See Also: OptimalFir::RemezFirLength, OptimalFir::remez
Declared in Dew::Signal::Units::OptimalFir · Dew.Signal/Units.OptimalFIR.h · Cross-compiler