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.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | bands | const DewArray<double> & | Band-edge frequencies in ascending pairs, relative to FS. |
| 2 | gains | const DewArray<double> & | Desired gain for each band (one per band). |
| 3 | Ripple | const DewArray<double> & | Maximum allowed ripple for each band (one per band; positive). |
| 4 | Weights | TVec * | Destination vector; receives one normalised error weight per band. |
| 5 | FS = 2 | double | Sampling frequency used to normalise bands; default 2. |
Returns: The estimated filter length (>= 3).
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.