SigPack - the C++ signal processing library
sp::IIR_filt< T1, T2, T3 > Class Template Reference

#include <filter.h>

Collaboration diagram for sp::IIR_filt< T1, T2, T3 >:
Collaboration graph

Public Member Functions

 IIR_filt ()
 
 ~IIR_filt ()
 
void clear (void)
 
void set_coeffs (const arma::Col< T2 > &_b, const arma::Col< T2 > &_a)
 
void update_coeffs (const arma::Col< T2 > &_b, const arma::Col< T2 > &_a)
 
T3 operator() (const T1 &in)
 
arma::Col< T3 > filter (const arma::Col< T1 > &in)
 

Private Attributes

arma::uword M
 
arma::uword N
 
arma::uword b_cur_p
 
arma::uword a_cur_p
 
arma::Col< T2 > b
 
arma::Col< T2 > a
 
arma::Col< T1 > b_buf
 
arma::Col< T1 > a_buf
 

Detailed Description

template<class T1, class T2, class T3>
class sp::IIR_filt< T1, T2, T3 >

Implements IIR/ARMA filter functions as

\[ a_0y(n) = b_0x(n)+b_1x(n-1)+...+b_{M-1}x(n-(M-1))-a_1y(n-1)-...-a_{M-1}y(n-(M-1))\]

where M is the number of taps in the FIR filter part and M is the number of taps in the IIR filter. The filter order is (M-1,M-1)

Examples:
fir_iir.cpp.

Definition at line 477 of file filter.h.

Constructor & Destructor Documentation

◆ IIR_filt()

template<class T1, class T2, class T3>
sp::IIR_filt< T1, T2, T3 >::IIR_filt ( )
inline

Constructor.

Definition at line 492 of file filter.h.

◆ ~IIR_filt()

template<class T1, class T2, class T3>
sp::IIR_filt< T1, T2, T3 >::~IIR_filt ( )
inline

Destructor.

Definition at line 497 of file filter.h.

Member Function Documentation

◆ clear()

template<class T1, class T2, class T3>
void sp::IIR_filt< T1, T2, T3 >::clear ( void  )
inline

Clears the internal states and pointers.

Definition at line 502 of file filter.h.

◆ filter()

template<class T1, class T2, class T3>
arma::Col<T3> sp::IIR_filt< T1, T2, T3 >::filter ( const arma::Col< T1 > &  in)
inline

Filter function.

Returns
Filtered output
Parameters
inInput vector

Definition at line 585 of file filter.h.

Referenced by main().

◆ operator()()

template<class T1, class T2, class T3>
T3 sp::IIR_filt< T1, T2, T3 >::operator() ( const T1 &  in)
inline

Filter operator.

Returns
Filtered output
Parameters
inInput sample

Definition at line 544 of file filter.h.

References sp::FIR_filt< T1, T2, T3 >::M.

◆ set_coeffs()

template<class T1, class T2, class T3>
void sp::IIR_filt< T1, T2, T3 >::set_coeffs ( const arma::Col< T2 > &  _b,
const arma::Col< T2 > &  _a 
)
inline

Sets coefficients in IIR filter. The internal state and pointers are cleared.

Parameters
_bFilter coefficients \( [b_0 ..b_M] \)
_aFilter coefficients \( [a_0 ..a_N] \)

Definition at line 516 of file filter.h.

References sp::FIR_filt< T1, T2, T3 >::clear().

Referenced by main().

Here is the call graph for this function:

◆ update_coeffs()

template<class T1, class T2, class T3>
void sp::IIR_filt< T1, T2, T3 >::update_coeffs ( const arma::Col< T2 > &  _b,
const arma::Col< T2 > &  _a 
)
inline

Updates coefficients in filter without clearing the internal states.

Parameters
_bFilter coefficients \( [b_0 ..b_M] \)
_aFilter coefficients \( [a_0 ..a_N] \)

Definition at line 533 of file filter.h.

Member Data Documentation

◆ a

template<class T1, class T2, class T3>
arma::Col<T2> sp::IIR_filt< T1, T2, T3 >::a
private

AR Filter coefficients.

Definition at line 485 of file filter.h.

◆ a_buf

template<class T1, class T2, class T3>
arma::Col<T1> sp::IIR_filt< T1, T2, T3 >::a_buf
private

AR Signal buffer.

Definition at line 487 of file filter.h.

◆ a_cur_p

template<class T1, class T2, class T3>
arma::uword sp::IIR_filt< T1, T2, T3 >::a_cur_p
private

Pointer to current sample in AR buffer.

Definition at line 483 of file filter.h.

◆ b

template<class T1, class T2, class T3>
arma::Col<T2> sp::IIR_filt< T1, T2, T3 >::b
private

MA Filter coefficients.

Definition at line 484 of file filter.h.

◆ b_buf

template<class T1, class T2, class T3>
arma::Col<T1> sp::IIR_filt< T1, T2, T3 >::b_buf
private

MA Signal buffer.

Definition at line 486 of file filter.h.

◆ b_cur_p

template<class T1, class T2, class T3>
arma::uword sp::IIR_filt< T1, T2, T3 >::b_cur_p
private

Pointer to current sample in MA buffer.

Definition at line 482 of file filter.h.

◆ M

template<class T1, class T2, class T3>
arma::uword sp::IIR_filt< T1, T2, T3 >::M
private

Nr of MA filter taps.

Definition at line 480 of file filter.h.

◆ N

template<class T1, class T2, class T3>
arma::uword sp::IIR_filt< T1, T2, T3 >::N
private

Nr of AR filter taps.

Definition at line 481 of file filter.h.


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