GNU Radio 3.7.0 C++ API
gr::filter::kernel::iir_filter< i_type, o_type, tap_type > Class Template Reference

base class template for Infinite Impulse Response filter (IIR) More...

#include <iir_filter.h>

List of all members.

Public Member Functions

 iir_filter (const std::vector< tap_type > &fftaps, const std::vector< tap_type > &fbtaps, bool oldstyle=true) throw (std::invalid_argument)
 Construct an IIR with the given taps.
 iir_filter ()
 ~iir_filter ()
o_type filter (const i_type input)
 compute a single output value.
void filter_n (o_type output[], const i_type input[], long n)
 compute an array of N output values. input must have N valid entries.
unsigned ntaps_ff () const
unsigned ntaps_fb () const
void set_taps (const std::vector< tap_type > &fftaps, const std::vector< tap_type > &fbtaps) throw (std::invalid_argument)
 install new taps.

Protected Attributes

bool d_oldstyle
std::vector< tap_type > d_fftaps
std::vector< tap_type > d_fbtaps
int d_latest_n
int d_latest_m
std::vector< tap_type > d_prev_output
std::vector< i_type > d_prev_input

Detailed Description

template<class i_type, class o_type, class tap_type>
class gr::filter::kernel::iir_filter< i_type, o_type, tap_type >

base class template for Infinite Impulse Response filter (IIR)


Constructor & Destructor Documentation

template<class i_type , class o_type , class tap_type >
gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::iir_filter ( const std::vector< tap_type > &  fftaps,
const std::vector< tap_type > &  fbtaps,
bool  oldstyle = true 
) throw (std::invalid_argument) [inline]

Construct an IIR with the given taps.

This filter uses the Direct Form I implementation, where fftaps contains the feed-forward taps, and fbtaps the feedback ones.

fftaps and fbtaps must have equal numbers of taps

oldstyle: The old style of the IIR filter uses feedback taps that are negative of what most definitions use (scipy and Matlab among them). This parameter keeps using the old GNU Radio style and is set to TRUE by default. When taps generated from scipy, Matlab, or gr_filter_design, use the new style by setting this to FALSE.

The input and output satisfy a difference equation of the form

\[ y[n] \pm \sum_{k=1}^{M} a_k y[n-k] = \sum_{k=0}^{N} b_k x[n-k] \]

with the corresponding rational system function

\[ H(z) = \frac{\sum_{k=0}^{N} b_k z^{-k}}{1 \pm \sum_{k=1}^{M} a_k z^{-k}} \]

References gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::d_oldstyle, and gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::set_taps().

template<class i_type , class o_type , class tap_type >
gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::iir_filter ( ) [inline]
template<class i_type , class o_type , class tap_type >
gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::~iir_filter ( ) [inline]

Member Function Documentation

template<class i_type , class o_type , class tap_type >
o_type gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::filter ( const i_type  input)

compute a single output value.

Returns:
the filtered input value.
template<class i_type , class o_type , class tap_type >
void gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::filter_n ( o_type  output[],
const i_type  input[],
long  n 
)

compute an array of N output values. input must have N valid entries.

template<class i_type , class o_type , class tap_type >
unsigned gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::ntaps_fb ( ) const [inline]
template<class i_type , class o_type , class tap_type >
unsigned gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::ntaps_ff ( ) const [inline]
Returns:
number of taps in filter.

References gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::d_fftaps.


Member Data Documentation

template<class i_type , class o_type , class tap_type >
std::vector<tap_type> gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::d_fbtaps [protected]
template<class i_type , class o_type , class tap_type >
std::vector<tap_type> gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::d_fftaps [protected]
template<class i_type , class o_type , class tap_type >
int gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::d_latest_m [protected]
template<class i_type , class o_type , class tap_type >
int gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::d_latest_n [protected]
template<class i_type , class o_type , class tap_type >
std::vector<i_type> gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::d_prev_input [protected]
template<class i_type , class o_type , class tap_type >
std::vector<tap_type> gr::filter::kernel::iir_filter< i_type, o_type, tap_type >::d_prev_output [protected]

The documentation for this class was generated from the following file: