Qu

kaiser

Builtin index · Signal processing

result = kaiser(n, beta)

Input: n, beta · Output: result

What it is

n: a number (integer window length); beta: a number, required second positional argument (no default — it fundamentally changes the main-lobe-width/side-lobe-level tradeoff).

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = kaiser(n, beta)
n numbern: a number (integer window length).
beta numberbeta: a number, required second positional argument (no default — it fundamentally changes the main-lobe-width/side-lobe-level tradeoff).
result vector
Returns a length-n real vector, w[i] = I0(beta*sqrt(1-((2i/(n-1))-1)^2)) / I0(beta). Center sample is always 1.0 for any beta.

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

kaiser(n, beta) — w[i] = I0(beta*sqrt(1-((2i/(n-1))-1)^2)) I0(beta), beta a required second positional argument (not an optional style knob: it fundamentally changes the main-lobe-width/side-lobe-level tradeoff, there's no sane silent default the way duty/carrier are optional elsewhere in this file). Same symmetric (n-1) convention. beta=0 makes I0(0)/I0(0) = 1 at every sample (a flat all-ones window); the center sample of an odd-length window always has (2i/(n-1))-1 == 0, so its numerator is exactly I0(beta), giving w[center] == 1.0 for any beta.

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