hann

Hann window slice generator

pure nothrow @nogc @safe
hann
(
size_t n
,
double a = 0.5
,
double b = 0.25
)

Parameters

n size_t

length of window

a double

window parameter

b double

window parameter

Return Value

Type: auto

window weight slice

Examples

import numir.signal;
import std.meta : AliasSeq;
import mir.ndslice : maxIndex;
import std.math : approxEqual;
// test windows are symmetry and peaked at median
auto n = 11;
static foreach (wfun; AliasSeq!(blackman, hann))
{{
    auto w = wfun(n);
    assert(w.maxIndex[0] == n / 2);
    foreach (i; 0 .. n / 2 - 1)
    {
        assert(w[i].approxEqual(w[$ - 1 - i]));
    }
}}

See Also

Meta