-
Notifications
You must be signed in to change notification settings - Fork 0
math.MathUtils.Function.simpleMovingAverage
Christian d'Heureuse edited this page Jun 7, 2026
·
2 revisions
dsp-collection / math/MathUtils / simpleMovingAverage
function simpleMovingAverage(
a,
windowWidth,
shift?): Float64Array;Defined in: math/MathUtils.ts:93
Calculates the simple moving average (SMA) over an array of numbers.
Each element of the output array contains the mean value of the window centered at that position in the input array.
When the window width is even, the shift parameter specifies whether the resulting position is 0.5 to the
left (shift = false) or to the right (shift = true) of the window center.
Edge cases are handled by cutting the rectangular moving window at the edge.
ArrayLike<number>
number
boolean = false
Float64Array