A class for single-pole infinite impulse response filters or exponential moving average filters.
More...
#include <EMA.hpp>
|
| EMA_f (float pole) |
| Create an exponential moving average filter with a pole at the given location. More...
|
|
float | filter (float value) |
| Filter the input: Given \( x[n] \), calculate \( y[n] \). More...
|
|
float | operator() (float value) |
| Filter the input: Given \( x[n] \), calculate \( y[n] \). More...
|
|
A class for single-pole infinite impulse response filters or exponential moving average filters.
This version uses floating point maths.
Difference equation: \( y[n] = \alpha·x[n]+(1-\alpha)·y[n-1] \) \( x \) is the input sequence, and \( y \) is the output sequence.
An in-depth explanation of the EMA filter
Definition at line 93 of file EMA.hpp.
◆ EMA_f()
EMA_f::EMA_f |
( |
float |
pole | ) |
|
|
inline |
Create an exponential moving average filter with a pole at the given location.
- Parameters
-
pole | The pole of the filter ( \(1-\alpha\)).
Should be a value in the range \( \left[0,1\right) \).
Zero means no filtering, and closer to one means more filtering. |
Definition at line 105 of file EMA.hpp.
◆ filter()
float EMA_f::filter |
( |
float |
value | ) |
|
|
inline |
Filter the input: Given \( x[n] \), calculate \( y[n] \).
- Parameters
-
value | The new raw input value. |
- Returns
- The new filtered output value.
Definition at line 114 of file EMA.hpp.
◆ operator()()
float EMA_f::operator() |
( |
float |
value | ) |
|
|
inline |
Filter the input: Given \( x[n] \), calculate \( y[n] \).
- Parameters
-
value | The new raw input value. |
- Returns
- The new filtered output value.
Definition at line 126 of file EMA.hpp.
◆ alpha
◆ filtered
float EMA_f::filtered = 0 |
|
private |
The documentation for this class was generated from the following file: