Skip to content

math.MathUtils.Function.triangularMovingAverage

Christian d'Heureuse edited this page Jun 7, 2026 · 2 revisions

dsp-collection / math/MathUtils / triangularMovingAverage

Function: triangularMovingAverage()

function triangularMovingAverage(a, windowWidth): Float64Array;

Defined in: math/MathUtils.ts:124

Calculates the triangular moving average (TMA) over an array of numbers.

Each element of the output array contains the triangular weighted value of the window centered at that position in the input array. Note that the elements at the border of the triangular window are not included. Due to the optimization and the cutting at the edges of the input array, the values at the edges of the output array are not the same as when calculated with triangularMovingAverageRef().

Parameters

a

ArrayLike<number>

windowWidth

number

Returns

Float64Array

Clone this wiki locally