Qu

window

Builtin index · Signal processing

result = window(name, n, [sym=true], [beta=], [alpha=0.5], [std=])

Input: name, n, sym, beta, alpha, std · Output: result

What it is

name: string, one of "hann" (or "hanning"), "hamming", "blackman", "kaiser" (needs beta=), "rect" (or "rectangular", "boxcar"), "bartlett" (triangle, zero at both ends), "tukey" (cosine taper over the fraction alpha= of the window, default 0.5; 0 is rectangular, 1 is Hann), "gaussian" (needs std=, the standard deviation in samples), "blackmanharris" (4-term Blackman-Harris), "nuttall" (Nuttall's 4-term) and "flattop" (5-term, for amplitude accuracy; slightly negative near the ends); n: number (length); sym (optional bool, positional or sym=): true (default) gives the symmetric window, the one for filter design (window("hann", 5) is [0, 0.5, 1, 0.5, 0]); false gives the periodic window, the one for spectral analysis: the symmetric window of length n+1 without its last sample (window("hann", 4, sym=false) is [0, 0.5, 1, 0.5]).

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
result = window(name, n, [sym=true], [beta=], [alpha=0.5], [std=])
name stringname: string, one of "hann" (or "hanning"), "hamming", "blackman", "kaiser" (needs beta=), "rect" (or "rectangular", "boxcar"), "bartlett" (triangle, zero at both ends), "tukey" (cosine taper over the fraction alpha= of the window, default 0.5.
n numbern: number (length).
sym bool, optional (default true)sym (optional bool, positional or sym=): true (default) gives the symmetric window, the one for filter design (window("hann", 5) is [0, 0.5, 1, 0.5, 0]).
beta string, optionalname: string, one of "hann" (or "hanning"), "hamming", "blackman", "kaiser" (needs beta=), "rect" (or "rectangular", "boxcar"), "bartlett" (triangle, zero at both ends), "tukey" (cosine taper over the fraction alpha= of the window, default 0.5.
alpha string, optional (default 0.5)name: string, one of "hann" (or "hanning"), "hamming", "blackman", "kaiser" (needs beta=), "rect" (or "rectangular", "boxcar"), "bartlett" (triangle, zero at both ends), "tukey" (cosine taper over the fraction alpha= of the window, default 0.5.
std optional0 is rectangular, 1 is Hann), "gaussian" (needs std=, the standard deviation in samples), "blackmanharris" (4-term Blackman-Harris), "nuttall" (Nuttall's 4-term) and "flattop" (5-term, for amplitude accuracy.
fir1 —symmetric
impedance —periodic
Returns the named window as a length-n real vector. The same names are accepted by window= in fir1 (symmetric) and in welch, periodogram, psd, csd, spectrum, spectral_coherence, transfer_function and impedance (periodic), with the window's parameter passed alongside (welch(x, fs, window="tukey", alpha=0.25)). Coefficients are those of MATLAB and SciPy.

Examples

No documentation example calls this form yet. The Signal processing chapter is where one belongs.

How it works

window(name, n, [sym=true], ...) -- any of the named windows as a vector. sym=true is the symmetric form (filter design), sym=false the periodic one (spectral analysis). The same table fir1 and the spectral estimators read their window= from (design_window).

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