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

#include <Filters/BiQuad.hpp>

Detailed Description

template<class T>
class NonNormalizingBiQuadFilterDF1< T >

BiQuad filter Direct Form 1 implementation that does not normalize the coefficients upon initialization, the division by \( a_0 \) is carried out on each filter iteration.

This class is slower than NormalizingBiQuadFilterDF1, but it works better for integer types, because it has no rounding error on the coefficients.

Implements the following difference equation:

\[ y[n] = \frac{b_0 \cdot x[n] + b_1 \cdot x[n-1] + b_2 \cdot x[n-2] - a_1 \cdot y[n-1] - a_2 \cdot y[n-2]}{a_0} \]

Definition at line 124 of file BiQuad.hpp.

+ Collaboration diagram for NonNormalizingBiQuadFilterDF1< T >:

Public Member Functions

 NonNormalizingBiQuadFilterDF1 ()=default
 
 NonNormalizingBiQuadFilterDF1 (const AH::Array< T, 3 > &b, const AH::Array< T, 3 > &a)
 
 NonNormalizingBiQuadFilterDF1 (const BiQuadCoefficients< T > &coefficients)
 
 NonNormalizingBiQuadFilterDF1 (const AH::Array< T, 3 > &b, const AH::Array< T, 3 > &a, T gain)
 
 NonNormalizingBiQuadFilterDF1 (const BiQuadCoefficients< T > &coefficients, T gain)
 
operator() (T input)
 Update the internal state with the new input \( x[n] \) and return the new output \( y[n] \). More...
 

Static Public Member Functions

template<bool Enable = true>
static std::enable_if_t< std::is_floating_point< T >::value &&Enable, T > update (T input, AH::Array< T, 2 > &x, AH::Array< T, 2 > &y, const AH::Array< T, 3 > &b, const AH::Array< T, 2 > &a, T a0)
 
template<bool Enable = true>
static std::enable_if_t<!std::is_floating_point< T >::value &&Enable, T > update (T input, AH::Array< T, 2 > &x, AH::Array< T, 2 > &y, const AH::Array< T, 3 > &b, const AH::Array< T, 2 > &a, T a0)
 

Private Attributes

AH::Array< T, 2 > x = {{}}
 Previous inputs. More...
 
AH::Array< T, 2 > y = {{}}
 Previous outputs. More...
 
AH::Array< T, 3 > b = {{}}
 Numerator coefficients. More...
 
AH::Array< T, 2 > a = {{}}
 Denominator coefficients. More...
 
a0 = T(1.)
 First denominator coefficient. More...
 

Constructor & Destructor Documentation

◆ NonNormalizingBiQuadFilterDF1() [1/5]

◆ NonNormalizingBiQuadFilterDF1() [2/5]

NonNormalizingBiQuadFilterDF1 ( const AH::Array< T, 3 > &  b,
const AH::Array< T, 3 > &  a 
)
inline

Definition at line 128 of file BiQuad.hpp.

◆ NonNormalizingBiQuadFilterDF1() [3/5]

NonNormalizingBiQuadFilterDF1 ( const BiQuadCoefficients< T > &  coefficients)
inline

Definition at line 132 of file BiQuad.hpp.

◆ NonNormalizingBiQuadFilterDF1() [4/5]

NonNormalizingBiQuadFilterDF1 ( const AH::Array< T, 3 > &  b,
const AH::Array< T, 3 > &  a,
gain 
)
inline

Definition at line 135 of file BiQuad.hpp.

◆ NonNormalizingBiQuadFilterDF1() [5/5]

NonNormalizingBiQuadFilterDF1 ( const BiQuadCoefficients< T > &  coefficients,
gain 
)
inline

Definition at line 139 of file BiQuad.hpp.

Member Function Documentation

◆ update() [1/2]

static std::enable_if_t< std::is_floating_point< T >::value &&Enable, T > update ( input,
AH::Array< T, 2 > &  x,
AH::Array< T, 2 > &  y,
const AH::Array< T, 3 > &  b,
const AH::Array< T, 2 > &  a,
a0 
)
inlinestatic

Definition at line 145 of file BiQuad.hpp.

◆ update() [2/2]

static std::enable_if_t<!std::is_floating_point< T >::value &&Enable, T > update ( input,
AH::Array< T, 2 > &  x,
AH::Array< T, 2 > &  y,
const AH::Array< T, 3 > &  b,
const AH::Array< T, 2 > &  a,
a0 
)
inlinestatic

Definition at line 161 of file BiQuad.hpp.

◆ 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 183 of file BiQuad.hpp.

Member Data Documentation

◆ x

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

Previous inputs.

Definition at line 186 of file BiQuad.hpp.

◆ y

AH::Array<T, 2> y = {{}}
private

Previous outputs.

Definition at line 187 of file BiQuad.hpp.

◆ b

AH::Array<T, 3> b = {{}}
private

Numerator coefficients.

Definition at line 188 of file BiQuad.hpp.

◆ a

AH::Array<T, 2> a = {{}}
private

Denominator coefficients.

Definition at line 189 of file BiQuad.hpp.

◆ a0

T a0 = T(1.)
private

First denominator coefficient.

Definition at line 190 of file BiQuad.hpp.


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