Skip to content
CoreSource checked

Exponential Moving Average

Smooths a sequence by blending each new value with the previous smoothed value.

Quick Facts

Compact metadata for implementation and discovery.

Category
Signal Processing
Difficulty
Beginner
Family
Recursive Filter
Tier
Core
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
2
Code example
Ready
Visualization
Ready

Overview

An Exponential Moving Average gives recent samples more weight while retaining a fading memory of older samples.

Core Concepts

recursive smoothingsmoothing factorstreaming statelow-pass behavior

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(1)

Average

O(n)

Worst

O(n)

Space

O(1)

When to Use

  • Use when a streaming trend estimate is needed with constant memory.
  • Use when metrics dashboards is a central requirement.

When Not to Use

  • Avoid when a fixed finite window average is required for interpretability.
  • Avoid when the sampling rate, window size, or stationarity assumptions do not hold.

What It Does

  • Blends new samples with prior state
  • Smooths short-term noise
  • Responds faster than a long simple average

Use Cases

  • Metrics dashboards
  • Sensor smoothing
  • Trend tracking

Inputs

  • Signal samples
  • Smoothing factor

Outputs

  • Smoothed sequence

Key Formulas (1)

EMA update

emanext = α · sample + (1 − α) · emaprevious
ema_next = alpha * sample + (1 - alpha) * ema_previous

Blends the latest sample with the previous smoothed value.

Pseudocode

  1. 1.Initialize the smoothed value
  2. 2.For each new sample, blend it with the previous smoothed value
  3. 3.Emit the updated smoothed value

Canonical Example

Input
previous = 10, sample = 14, alpha = 0.25
Output
next = 11
Explanation
The new estimate moves one quarter of the way from 10 to 14.

Implementation Notes

  • Document whether alpha is configured directly or derived from a time constant.
  • Plot or inspect both the original and processed signal for small test cases.
  • Keep a tiny example with known output beside the implementation.
  • Keep sampling rate, window size, latency, and boundary conventions explicit in tests.

Common Pitfalls

  • Initialization can bias early values if not handled clearly.
  • Boundary handling and phase response can change the result in visible or audible ways.
  • Not defining boundary, empty, or degenerate inputs before implementation.
  • Ignoring sampling rate, boundary handling, or phase behavior can make the output misleading.

Interactive Mechanism Walkthrough

Iterative Convergence & State Trajectory

Show a noisy line and a smoother line that follows it with some lag.

Exponential Moving Average mechanism walkthrough step 1 of 3x₀x₁x₂x*
Step 1 of 3: Initialize the smoothed value
signal-transform

Notes

Smaller alpha values smooth more but react more slowly.

Sources (1)

What each reference supports for this entry.

Discrete-Time Signal Processing

Book

Signal-processing reference for digital filters, convolution, spectral analysis, windows, resampling, and transform-based methods.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Variant ofMoving Average

EMA replaces a fixed window with exponentially decaying weights.

Tags

Signal ProcessingFilteringSmoothingIterative