Qu

blackman

Builtin index · Signal processing

result = blackman(n)

Input: n · Output: result

What it is

n: a number (integer window length).

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = blackman(n)
n numbernot documented yet
result vector
Returns a length-n real vector. Standard 3-term Blackman window, a0 - a1*cos(...) + a2*cos(2*...) with a0=0.42, a1=0.5, a2=0.08 (textbook "exact" coefficients). Endpoints are 0.0 exactly.

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

amp = db2mag(-6)     # amplitude ratio for -6 dB

pow = db2pow(-3)     # power ratio for -3 dB

print("db2mag(-6) = {amp}, db2pow(-3) = {pow}")

w_hamming = hamming(8)
w_blackman = blackman(8)
w_kaiser = kaiser(9, 5)             # beta=5, odd length so there's an exact center sample

print("hamming[0] = {w_hamming[0]}, blackman[0] = {w_blackman[0]}, kaiser center = {w_kaiser[4]}")

f = logspace(0, 3, 4)               # 1, 10, 100, 1000 -- a log-spaced frequency axis

print("logspace(0,3,4) = {f}")
output
db2mag(-6) = 0.501187, db2pow(-3) = 0.501187
hamming[0] = 0.08, blackman[0] = -1.387779e-17, kaiser center = 1
logspace(0,3,4) = [1, 10, 100, 1000]

from signal-processing

How it works

blackman(n) — the standard 3-term Blackman window, a0 - a1*cos(2*pi*i/(n-1)) + a2*cos(4*pi*i/(n-1)) with a0=0.42, a1=0.5, a2=0.08 (the "exact" textbook coefficients, not the very slightly different near-optimal variant some libraries ship). Same symmetric (n-1) convention. Endpoints: at i=0 and i=n-1 both cosines are 1, so w[0] == w[n-1] == a0 - a1 + a2 == 0.42 - 0.5 + 0.08 == 0.0 exactly.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.