Skip to content
Oakfield Operator Calculus Function Reference Site

Exponential Moving Average

For sequence {xn}\{x_n\}, smoothing factor α(0,1]\alpha \in (0,1], and initial m0m_0, define

mn=(1α)mn1+αxnm_n = (1-\alpha) m_{n-1} + \alpha x_n

Applies to real or complex sequences with bounded values. Output follows the same codomain.


Weights decay geometrically: contribution of xnkx_{n-k} is (1α)kα(1-\alpha)^k \alpha. Effective window length is O(1/α)O(1/\alpha). Linear and causal.


As α1\alpha \to 1, mnm_n tracks the latest sample; as α0\alpha \to 0, smoothing approaches a constant memory with slow adaptation. For constant input xn=cx_n = c, mncm_n \to c.


  • α=1\alpha=1 yields mn=xnm_n=x_n (no smoothing).
  • Small α\alpha yields slow adaptation with long memory.

Welford statistics provide unbiased variance updates; simple mean uses uniform weighting rather than exponential decay.


Oakfield uses EMAs for smoothing diagnostics and lock detection:

  • Phase coherence EMA: runtime stats track phase_coherence_ema using an exponential smoothing constant (seconds) and a hysteresis lock state.
  • General smoothing helper: runtime/sim_smoothing.h provides a canonical a = exp(-dt/tau) form used for stable time-constant smoothing in other subsystems.

Exponential smoothing is a standard recursive filter in time series analysis, trading unbiasedness for adaptivity and a simple one-step update.

EMA is widely used for online diagnostics and stabilizing noisy signals in simulation and optimization loops.


  • Hamilton, Time Series Analysis
  • Oppenheim & Schafer, Discrete-Time Signal Processing