Finite Impulse Response (FIR) Design using Parks-McClellan Algorithm ==================================================================== FIR filter design using the Parks-McClellan algorithm is implemented in liquid with the :api:`firdespm` interface. The Parks-McClellan algorithm uses the Remez exchange algorithm to solve the minimax problem (minimize the maximum error) for filter design. The interface accepts a description of :math:`N_b` disjoint and non-overlapping frequency bands with a desired response and relative error weighting for each, and computes the resulting filter coefficients. .. code-block:: c int firdespm_run(unsigned int _h_len, unsigned int _num_bands, float * _bands, float * _des, float * _weights, liquid_firdespm_wtype * _wtype, liquid_firdespm_btype _btype, float * _h); * :c:`_bands` is a :math:`[N_b \times 2]` matrix of the band edge descriptions. Each row corresponds to an upper and lower band edge for each region of interest. These regions cannot be overlapping. * :c:`_des` is an array of size :math:`N_b` with the desired response (linear) for each band. * :c:`_weights` is an array of size :math:`N_b` with the relative error weighting for each band. * :c:`_num_bands` represents :math:`N_b`, the number of bands in the design. * :c:`_btype` gives the filter type for the design. This is typically :api:`LIQUID_FIRDESPM_BANDPASS` for the majority of filters. * :c:`_wtype` is an array of length :math:`N_b` which specifies the weighting function for each band (flat, exponential, or linear). Example ~~~~~~~ Listed below is an example of the :api:`firdespm` interface. .. literalinclude:: firdespm.c :language: c .. qplot:: window firdes/firdespm.c :width: 80% :kwargs: {"figsize":[12,12], "layout":"rows", "onesided":true, "ylim":[-70,10]} :name: fig-firdespm :caption: Example of :api:`firdespm`