IT++ Logo
itpp::MA_Filter< T1, T2, T3 > Class Template Reference

Moving Average Filter Base Class. More...

#include <itpp/signal/filter.h>

Inheritance diagram for itpp::MA_Filter< T1, T2, T3 >:
itpp::Filter< T1, T2, T3 >

Public Member Functions

 MA_Filter ()
 Class default constructor.
 
 MA_Filter (const Vec< T2 > &b)
 Class constructor setting the coefficients in the filter.
 
virtual ~MA_Filter ()
 Class destructor.
 
Vec< T2 > get_coeffs () const
 Filter coefficient access function.
 
void set_coeffs (const Vec< T2 > &b)
 Set the filter coefficients.
 
void clear ()
 Clears the filter memory.
 
Vec< T3 > get_state () const
 Get state of filter.
 
void set_state (const Vec< T3 > &state)
 Set state of filter.
 
virtual T3 operator() (const T1 Sample)
 Filter a single sample.
 
virtual Vec< T3 > operator() (const Vec< T1 > &v)
 Filter a vector.
 

Detailed Description

template<class T1, class T2, class T3>
class itpp::MA_Filter< T1, T2, T3 >

Moving Average Filter Base Class.

This class implements a moving average (MA) filter according to

\[
y(n) = b(0)*x(n) + b(1)*x(n-1) + ... + b(N)*x(n-N)
\]

where b is the filter coefficients, x is the input and y is the output.

When filtering a vector, the length of the output vector equals the length of the input vector. Internal states are kept in a filter memory. The first time the filter is used the internal states have been set to zero.

The class is templated as follows:

  • T1 is the type of the input samples
  • T2 is the type of the filter coefficients
  • T3 is the type of the output samples

Definition at line 98 of file filter.h.

Constructor & Destructor Documentation

◆ MA_Filter() [1/2]

template<class T1 , class T2 , class T3 >
itpp::MA_Filter< T1, T2, T3 >::MA_Filter ( )
explicit

Class default constructor.

Definition at line 329 of file filter.h.

◆ MA_Filter() [2/2]

template<class T1 , class T2 , class T3 >
itpp::MA_Filter< T1, T2, T3 >::MA_Filter ( const Vec< T2 > & b)
explicit

Class constructor setting the coefficients in the filter.

Definition at line 336 of file filter.h.

References itpp::MA_Filter< T1, T2, T3 >::set_coeffs().

◆ ~MA_Filter()

template<class T1 , class T2 , class T3 >
virtual itpp::MA_Filter< T1, T2, T3 >::~MA_Filter ( )
inlinevirtual

Class destructor.

Definition at line 106 of file filter.h.

Member Function Documentation

◆ get_coeffs()

template<class T1 , class T2 , class T3 >
Vec< T2 > itpp::MA_Filter< T1, T2, T3 >::get_coeffs ( ) const
inline

Filter coefficient access function.

Definition at line 108 of file filter.h.

◆ set_coeffs()

template<class T1 , class T2 , class T3 >
void itpp::MA_Filter< T1, T2, T3 >::set_coeffs ( const Vec< T2 > & b)

Set the filter coefficients.

Definition at line 343 of file filter.h.

References it_assert, itpp::Vec< Num_T >::set_size(), and itpp::Vec< Num_T >::size().

Referenced by itpp::FIR_Fading_Generator::init(), and itpp::MA_Filter< T1, T2, T3 >::MA_Filter().

◆ clear()

template<class T1 , class T2 , class T3 >
void itpp::MA_Filter< T1, T2, T3 >::clear ( )
inline

Clears the filter memory.

Definition at line 112 of file filter.h.

References itpp::Vec< Num_T >::clear().

◆ get_state()

template<class T1 , class T2 , class T3 >
Vec< T3 > itpp::MA_Filter< T1, T2, T3 >::get_state ( ) const

Get state of filter.

Definition at line 355 of file filter.h.

References it_assert.

Referenced by itpp::filter(), itpp::filter(), itpp::filter(), and itpp::filter().

◆ set_state()

template<class T1 , class T2 , class T3 >
void itpp::MA_Filter< T1, T2, T3 >::set_state ( const Vec< T3 > & state)

Set state of filter.

Definition at line 371 of file filter.h.

References it_assert, and itpp::Vec< Num_T >::size().

Referenced by itpp::filter(), itpp::filter(), itpp::filter(), and itpp::filter().

◆ operator()() [1/2]

template<class T1 , class T2 , class T3 >
virtual T3 itpp::Filter< T1, T2, T3 >::operator() ( const T1 Sample)
inlinevirtualinherited

Filter a single sample.

Definition at line 60 of file filter.h.

References itpp::Filter< T1, T2, T3 >::filter().

◆ operator()() [2/2]

template<class T1 , class T2 , class T3 >
Vec< T3 > itpp::Filter< T1, T2, T3 >::operator() ( const Vec< T1 > & v)
virtualinherited

Filter a vector.

Definition at line 315 of file filter.h.

References itpp::filter(), and itpp::Vec< Num_T >::length().


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

Generated on Tue Dec 10 2024 04:49:37 for IT++ by Doxygen 1.12.0