Investment Studio > Expressions > Functions > DSP > HANNING

Vector form: float array[1][length] hanning(integer length)

Returns a row vector (one row, length columns) containing the values of a Hanning window starting at position 1 and ending at position length > 1.

Scalar form: float hanning(integer length, integer position)

Returns the value in position >= 1 of a Hanning window starting at position 1 and ending at position length > 1.

The Hanning window function is defined as

omega = 2.0 * PI / (length - 1)

n = position - 1

hanning[n] = 0.5 - 0.5 * cos(n * omega)

Example

The graph source

=hanning(100, x)

can be used to create the following graph:

See also blackman, convolve, hamming, rectangle, triangle.