A Moving Average on a Step Change

A moving average spreads an abrupt change across the samples included in its window.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace two window outputs
  2. Name the timestamp of each average
  3. Track the window as new values enter
  4. Specify how the beginning is initialized

Trace two window outputs

For values zero, zero, four, four, a full-width-two average gives 0, 2, and 4. The middle window includes both sides of the change. See sliding windows.

Name the timestamp of each average

A trailing window can assign that middle result to its later sample. A centered convention can report another time. Time stamps and gaps make the relation visible.[1][2]

Track the window as new values enter

Apply a trailing width-three mean to a sequence stepping from zero to six at index zero. The first output after the step is two when previous values stay zero. After the second sample it is four, and the third reaches six. See fixed sliding windows.

n=0: [0,0,6] → 2
n=1: [0,6,6] → 4
n=2: [6,6,6] → 6
Later samples remain 6 for a persistent step

Specify how the beginning is initialized

Zero padding, delaying output until a full window, and averaging just available values give different early results. Test the documented startup and a brief impulse as well as a sustained change.

References

  1. MIT OpenCourseWare, 6.003 Signals and Systems ↩
  2. David J. C. MacKay, Information Theory, Inference, and Learning Algorithms ↩