Arduino Filters master
Filter library for Arduino
Functions
Filter Design

Detailed Description

Filter design tools.

+ Collaboration diagram for Filter Design:

Functions

template<uint8_t N, class T = float>
SOSCoefficients< T,(N+1)/2 > butter_coeff (double f_n, bool normalize=true)
 Compute Butterworth filter coefficients. More...
 
template<uint8_t N, class T = float, class Implementation = BiQuadFilterDF1<T>>
SOSFilter< T,(N+1)/2, Implementation > butter (double f_n, bool normalize=true)
 Create a Butterworth filter, implemented as Second Order Sections (SOS) filter. More...
 
template<class T = float>
FIRFilter< 3, T > simpleNotchFIR (double f_n)
 Create a very simple second-order FIR notch filter. More...
 
template<class T , size_t N>
TransferFunction< N *2+1, N *2+1, T > sos2tf (const SOSCoefficients< T, N > &sos)
 Convert Second Order Section (SOS) coefficients to an equivalent tranfer function representation. More...
 

Function Documentation

◆ butter_coeff()

SOSCoefficients< T,(N+1)/2 > butter_coeff ( double  f_n,
bool  normalize = true 
)

Compute Butterworth filter coefficients.

Template Parameters
NOrder of the filter.
Parameters
f_nNormalized cut-off frequency in half-cycles per sample.
\( f_n = \frac{2 f_c}{f_s} \in \left[0, 1\right] \), where \( f_s \) is the sample frequency in \( \text{Hz} \), and \( f_c \) is the cut-off frequency in \( \text{Hz} \).
normalizeIf true, normalize all coefficients such that \( a_0 = 1 \).
Template Parameters
TThe type of the coefficients.
See also
https://tttapa.github.io/Pages/Mathematics/Systems-and-Control-Theory/Digital-filters/Discretization/Discretization-of-a-fourth-order-Butterworth-filter.html#discretization-using-second-order-sections-sos

Definition at line 26 of file Butterworth.hpp.

◆ butter()

SOSFilter< T,(N+1)/2, Implementation > butter ( double  f_n,
bool  normalize = true 
)

Create a Butterworth filter, implemented as Second Order Sections (SOS) filter.

Template Parameters
NOrder of the filter.
Parameters
f_nNormalized cut-off frequency in half-cycles per sample.
\( f_n = \frac{2 f_c}{f_s} \in \left[0, 1\right] \), where \( f_s \) is the sample frequency in \( \text{Hz} \), and \( f_c \) is the cut-off frequency in \( \text{Hz} \).
Template Parameters
TThe type of filter values and coefficients.
Parameters
normalizeIf true, normalize all coefficients such that \( a_0 = 1 \).
Template Parameters
ImplementationThe BiQuad implementation to use.
See also
https://tttapa.github.io/Pages/Mathematics/Systems-and-Control-Theory/Digital-filters/Discretization/Discretization-of-a-fourth-order-Butterworth-filter.html#discretization-using-second-order-sections-sos

Definition at line 109 of file Butterworth.hpp.

◆ simpleNotchFIR()

FIRFilter< 3, T > simpleNotchFIR ( double  f_n)

Create a very simple second-order FIR notch filter.

\[ H(z) = \frac{z^2 - 2\cos\left(\omega_{c,d}\right)z + 1} {2 - 2\cos\left(\omega_{c,d}\right)} \]

where \( \omega_{c,d} = \pi f_n = 2\pi \frac{f_c}{f_n} \)

See also
https://tttapa.github.io/Pages/Mathematics/Systems-and-Control-Theory/Digital-filters/FIR-Notch.html
Parameters
f_nNormalized notch frequency in half-cycles per sample.
\( f_n = \frac{2 f_c}{f_s} \in \left[0, 1\right] \), where \( f_s \) is the sample frequency in \( \text{Hz} \), and \( f_c \) is the analog notch frequency in \( \text{Hz} \).
Examples
FIRNotch.ino.

Definition at line 27 of file Notch.hpp.

◆ sos2tf()

TransferFunction< N *2+1, N *2+1, T > sos2tf ( const SOSCoefficients< T, N > &  sos)

Convert Second Order Section (SOS) coefficients to an equivalent tranfer function representation.

Definition at line 76 of file SOSFilter.hpp.