OptimalFir.RemezLength Method

function RemezLength(bands: TDoubleArray; gains: TDoubleArray; Ripple: TDoubleArray; Weights: TVec; FS: Double): Integer;

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

#NameDescription
1bandsBand-edge frequencies in ascending pairs, relative to FS.
2gainsDesired gain for each band (one per band).
3RippleMaximum allowed ripple for each band (one per band
4positive).
5WeightsDestination vector
6receives one normalised error weight per band.
7FSSampling frequency used to normalise bands
8default 2.

Returns: Int32 - 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