Smoothed Filter

template<typename T, T Alpha>
struct Smoothed

Filter with exponential smoothing.

This stateful filter applies exponential smoothing and rejects rapid variations that exceed the expected smoothed prediction.

Since

v0.1.0

// Example: Exponential smoothing with alpha 0.3
Signal<float, 10, Smoothed<float, 0.3>> smooth(0.0);

Note

Stateful filter. Rejects rapid variations.

Warning

  • Only accepts floating-point types (float, double).

  • Alpha must be between 0 and 1.

Template Parameters:
typename T

Floating-point type.

T Alpha

Smoothing factor (0-1), higher = less smoothing.

Public Functions

inline bool operator()(const T &old_value, const T &new_value) const

Public Members

mutable T smoothed_value = T()
mutable bool initialized = false

See Also