SigPack - the C++ signal processing library
 
Loading...
Searching...
No Matches
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 503 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 518 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 525 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

◆ 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
Examples
fir_iir.cpp.

Definition at line 615 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

◆ 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] \)
Examples
fir_iir.cpp.

Definition at line 546 of file filter.h.

References sp::IIR_filt< T1, T2, T3 >::a, sp::IIR_filt< T1, T2, T3 >::a_buf, sp::IIR_filt< T1, T2, T3 >::b_buf, sp::IIR_filt< T1, T2, T3 >::clear(), sp::IIR_filt< T1, T2, T3 >::M, and sp::IIR_filt< T1, T2, T3 >::N.

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 563 of file filter.h.

References sp::IIR_filt< T1, T2, T3 >::a, and sp::IIR_filt< T1, T2, T3 >::b.

Member Data Documentation

◆ a

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

◆ a_buf

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

◆ 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 509 of file filter.h.

Referenced by sp::IIR_filt< T1, T2, T3 >::clear(), and sp::IIR_filt< T1, T2, T3 >::operator()().

◆ 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 510 of file filter.h.

Referenced by sp::IIR_filt< T1, T2, T3 >::operator()(), and sp::IIR_filt< T1, T2, T3 >::update_coeffs().

◆ b_buf

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

◆ 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 508 of file filter.h.

Referenced by sp::IIR_filt< T1, T2, T3 >::clear(), and sp::IIR_filt< T1, T2, T3 >::operator()().

◆ 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 506 of file filter.h.

Referenced by sp::IIR_filt< T1, T2, T3 >::operator()(), and sp::IIR_filt< T1, T2, T3 >::set_coeffs().

◆ 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 507 of file filter.h.

Referenced by sp::IIR_filt< T1, T2, T3 >::operator()(), and sp::IIR_filt< T1, T2, T3 >::set_coeffs().


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