Arduino Filters master
Filter library for Arduino
Public Member Functions | Private Attributes | List of all members
FIRFilter< N, T > Class Template Reference

#include <Filters/FIRFilter.hpp>

Detailed Description

template<uint8_t N, class T = float>
class FIRFilter< N, T >

Finite Impulse Response filter implementation.

Implements the following difference equation:

\[ y[n] = \sum_{i=0}^{N-1} b_i \cdot x[n-i] \]

Definition at line 18 of file FIRFilter.hpp.

+ Collaboration diagram for FIRFilter< N, T >:

Public Member Functions

 FIRFilter (const AH::Array< T, N > &coefficients)
 Construct a new FIR Filter object. More...
 
operator() (T input)
 Update the internal state with the new input \( x[n] \) and return the new output \( y[n] \). More...
 

Private Attributes

uint8_t index_b = 0
 
AH::Array< T, N > x = {}
 
AH::Array< T, 2 *N - 1 > coefficients
 

Constructor & Destructor Documentation

◆ FIRFilter()

FIRFilter ( const AH::Array< T, N > &  coefficients)
inline

Construct a new FIR Filter object.

The coefficients \( b \) can be derived from the transfer function:

\[ H(z) = b_0 + b_1 z^{-1} + \ldots + b_{N_b} z ^{-N_b} \]

Parameters
coefficientsThe coefficients of the transfer function numerator.

Definition at line 32 of file FIRFilter.hpp.

Member Function Documentation

◆ operator()()

T operator() ( input)
inline

Update the internal state with the new input \( x[n] \) and return the new output \( y[n] \).

Parameters
inputThe new input \( x[n] \).
Returns
The new output \( y[n] \).

Definition at line 45 of file FIRFilter.hpp.

Member Data Documentation

◆ index_b

uint8_t index_b = 0
private

Definition at line 66 of file FIRFilter.hpp.

◆ x

AH::Array<T, N> x = {}
private

Definition at line 67 of file FIRFilter.hpp.

◆ coefficients

AH::Array<T, 2 * N - 1> coefficients
private

Definition at line 68 of file FIRFilter.hpp.


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