iirfilt_rrrf

Infinite impulse response (IIR) filter

Variants: iirfilt_cccf, iirfilt_crcf, iirfilt_rrrf

Public Functions

iirfilt_rrrf iirfilt_rrrf_create(float * _b, unsigned int _nb, float * _a, unsigned int _na)
iirfilt_rrrf iirfilt_rrrf_create_sos(float * _b, float * _a, unsigned int _nsos)
iirfilt_rrrf iirfilt_rrrf_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_rrrf iirfilt_rrrf_create_lowpass(unsigned int _order, float _fc)
iirfilt_rrrf iirfilt_rrrf_create_integrator()
iirfilt_rrrf iirfilt_rrrf_create_differentiator()
iirfilt_rrrf iirfilt_rrrf_create_dc_blocker(float _alpha)
iirfilt_rrrf iirfilt_rrrf_create_pll(float _w, float _zeta, float _K)
iirfilt_rrrf iirfilt_rrrf_copy(iirfilt_rrrf _q)
int iirfilt_rrrf_destroy(iirfilt_rrrf _q)
int iirfilt_rrrf_print(iirfilt_rrrf _q)
int iirfilt_rrrf_reset(iirfilt_rrrf _q)
int iirfilt_rrrf_execute(iirfilt_rrrf _q, float _x, float * _y)
int iirfilt_rrrf_execute_block(iirfilt_rrrf _q, float * _x, unsigned int _n, float * _y)
unsigned int iirfilt_rrrf_get_length(iirfilt_rrrf _q)
int iirfilt_rrrf_freqresponse(iirfilt_rrrf _q, float _fc, float complex * _H)
float iirfilt_rrrf_get_psd(iirfilt_rrrf _q, float _fc)
float iirfilt_rrrf_groupdelay(iirfilt_rrrf _q, float _fc)

Interfaces

iirfilt_rrrf iirfilt_rrrf_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_rrrf iirfilt_rrrf_create_sos(float * _b, float * _a, unsigned int _nsos)

Create IIR filter using 2nd-order secitons 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_rrrf iirfilt_rrrf_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_rrrf iirfilt_rrrf_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_rrrf iirfilt_rrrf_create_integrator()

Create 8th-order integrator filter

iirfilt_rrrf iirfilt_rrrf_create_differentiator()

Create 8th-order differentiator filter

iirfilt_rrrf iirfilt_rrrf_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_rrrf iirfilt_rrrf_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_rrrf iirfilt_rrrf_copy(iirfilt_rrrf _q)

Copy object including all internal objects and state

int iirfilt_rrrf_destroy(iirfilt_rrrf _q)

Destroy iirfilt object, freeing all internal memory

int iirfilt_rrrf_print(iirfilt_rrrf _q)

Print iirfilt object properties to stdout

int iirfilt_rrrf_reset(iirfilt_rrrf _q)

Reset iirfilt object internals

int iirfilt_rrrf_execute(iirfilt_rrrf _q, float _x, float * _y)

Compute filter output given a signle input sample

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

int iirfilt_rrrf_execute_block(iirfilt_rrrf _q, float * _x, unsigned int _n, float * _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_rrrf_get_length(iirfilt_rrrf _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_rrrf_freqresponse(iirfilt_rrrf _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_rrrf_get_psd(iirfilt_rrrf _q, float _fc)

Compute power spectral density response of filter object in dB

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

float iirfilt_rrrf_groupdelay(iirfilt_rrrf _q, float _fc)

Compute and return group delay of filter object

  • _q : filter object
  • _fc : frequency to evaluate