iirfilt_crcf

Variants: iirfilt_cccf, iirfilt_crcf, iirfilt_rrrf

Infinite impulse response (IIR) filter

Public Functions

iirfilt_crcf iirfilt_crcf_create(float * _b, unsigned int _nb, float * _a, unsigned int _na)
iirfilt_crcf iirfilt_crcf_create_sos(float * _b, float * _a, unsigned int _nsos)
iirfilt_crcf iirfilt_crcf_create_prototype(liquid_iirdes_filtertype _ftype, liquid_iirdes_bandtype _btype, liquid_iirdes_format _format, unsigned int _order, float _fc, float _f0, float _ap, float _as)
iirfilt_crcf iirfilt_crcf_create_lowpass(unsigned int _order, float _fc)
iirfilt_crcf iirfilt_crcf_create_integrator()
iirfilt_crcf iirfilt_crcf_create_differentiator()
iirfilt_crcf iirfilt_crcf_create_dc_blocker(float _alpha)
iirfilt_crcf iirfilt_crcf_create_pll(float _w, float _zeta, float _K)
iirfilt_crcf iirfilt_crcf_copy(iirfilt_crcf _q)
int iirfilt_crcf_destroy(iirfilt_crcf _q)
int iirfilt_crcf_print(iirfilt_crcf _q)
int iirfilt_crcf_reset(iirfilt_crcf _q)
int iirfilt_crcf_set_scale(iirfilt_crcf _q, float _scale)
int iirfilt_crcf_get_scale(iirfilt_crcf _q, float * _scale)
int iirfilt_crcf_execute(iirfilt_crcf _q, float complex _x, float complex * _y)
int iirfilt_crcf_execute_block(iirfilt_crcf _q, float complex * _x, unsigned int _n, float complex * _y)
unsigned int iirfilt_crcf_get_length(iirfilt_crcf _q)
int iirfilt_crcf_freqresponse(iirfilt_crcf _q, float _fc, float complex * _H)
float iirfilt_crcf_get_psd(iirfilt_crcf _q, float _fc)
float iirfilt_crcf_groupdelay(iirfilt_crcf _q, float _fc)

Interfaces

iirfilt_crcf iirfilt_crcf_create(float * _b, unsigned int _nb, float * _a, unsigned int _na)

Create infinite impulse response filter from external coefficients. Note that the number of feed-forward and feed-back coefficients do not need to be equal, but they do need to be non-zero. Furthermore, the first feed-back coefficient \(a_0\) cannot be equal to zero, otherwise the filter will be invalid as this value is factored out from all coefficients. For stability reasons the number of coefficients should reasonably not exceed about 8 for single-precision floating-point.

  • _b : feed-forward coefficients (numerator), shape: (_nb, 1)
  • _nb : number of feed-forward coefficients, 0 < _nb
  • _a : feed-back coefficients (denominator), shape: (_na, 1)
  • _na : number of feed-back coefficients, 0 < _na

iirfilt_crcf iirfilt_crcf_create_sos(float * _b, float * _a, unsigned int _nsos)

Create IIR filter using 2nd-order sections from external coefficients.

  • _b : feed-forward coefficients, shape: (_nsos, 3)
  • _a : feed-back coefficients, shape: (_nsos, 3)
  • _nsos : number of second-order sections (sos), 0 < _nsos

iirfilt_crcf iirfilt_crcf_create_prototype(liquid_iirdes_filtertype _ftype, liquid_iirdes_bandtype _btype, liquid_iirdes_format _format, unsigned int _order, float _fc, float _f0, float _ap, float _as)

Create IIR filter from design template

  • _ftype : filter type (e.g. LIQUID_IIRDES_BUTTER)
  • _btype : band type (e.g. LIQUID_IIRDES_BANDPASS)
  • _format : coefficients format (e.g. LIQUID_IIRDES_SOS)
  • _order : filter order, 0 < _order
  • _fc : low-pass prototype cut-off frequency, 0 <= _fc <= 0.5
  • _f0 : center frequency (band-pass, band-stop), 0 <= _f0 <= 0.5
  • _ap : pass-band ripple in dB, 0 < _ap
  • _as : stop-band ripple in dB, 0 < _as

iirfilt_crcf iirfilt_crcf_create_lowpass(unsigned int _order, float _fc)

Create simplified low-pass Butterworth IIR filter

  • _order : filter order, 0 < _order
  • _fc : low-pass prototype cut-off frequency

iirfilt_crcf iirfilt_crcf_create_integrator()

Create 8th-order integrator filter

iirfilt_crcf iirfilt_crcf_create_differentiator()

Create 8th-order differentiator filter

iirfilt_crcf iirfilt_crcf_create_dc_blocker(float _alpha)

Create simple first-order DC-blocking filter with transfer function \( H(z) = \frac{1 - z^{-1}}{1 - (1-\alpha)z^{-1}} \)

  • _alpha : normalized filter bandwidth, 0 < _alpha

iirfilt_crcf iirfilt_crcf_create_pll(float _w, float _zeta, float _K)

Create filter to operate as second-order integrating phase-locked loop (active lag design)

  • _w : filter bandwidth, 0 < _w < 1
  • _zeta : damping factor, \( 1/\sqrt{2} \) suggested, 0 < _zeta < 1
  • _K : loop gain, 0 < _K

iirfilt_crcf iirfilt_crcf_copy(iirfilt_crcf _q)

Copy object including all internal objects and state

int iirfilt_crcf_destroy(iirfilt_crcf _q)

Destroy iirfilt object, freeing all internal memory

int iirfilt_crcf_print(iirfilt_crcf _q)

Print iirfilt object properties to stdout

int iirfilt_crcf_reset(iirfilt_crcf _q)

Reset iirfilt object internals

int iirfilt_crcf_set_scale(iirfilt_crcf _q, float _scale)

Set output scaling for filter

  • _q : filter object
  • _scale : scaling factor to apply to each output sample

int iirfilt_crcf_get_scale(iirfilt_crcf _q, float * _scale)

Get output scaling for filter

  • _q : filter object
  • _scale : scaling factor applied to each output sample

int iirfilt_crcf_execute(iirfilt_crcf _q, float complex _x, float complex * _y)

Compute filter output given a single input sample

  • _q : iirfilt object
  • _x : input sample
  • _y : output sample pointer

int iirfilt_crcf_execute_block(iirfilt_crcf _q, float complex * _x, unsigned int _n, float complex * _y)

Execute the filter on a block of input samples; in-place operation is permitted (the input and output buffers may be the same)

  • _q : filter object
  • _x : pointer to input array, shape: (_n, 1)
  • _n : number of input, 0 < _n
  • _y : pointer to output array, shape: (_n, 1)

unsigned int iirfilt_crcf_get_length(iirfilt_crcf _q)

Return number of coefficients for iirfilt object (maximum between the feed-forward and feed-back coefficients). Note that the filter length = filter order + 1

int iirfilt_crcf_freqresponse(iirfilt_crcf _q, float _fc, float complex * _H)

Compute complex frequency response of filter object

  • _q : filter object
  • _fc : normalized frequency for evaluation
  • _H : pointer to output complex frequency response

float iirfilt_crcf_get_psd(iirfilt_crcf _q, float _fc)

Compute power spectral density response of filter object in dB

  • _q : filter object
  • _fc : normalized frequency for evaluation

float iirfilt_crcf_groupdelay(iirfilt_crcf _q, float _fc)

Compute and return group delay of filter object

  • _q : filter object
  • _fc : frequency to evaluate