numpy.blackman

numpy.blackman(M)[源代码]

返回布莱克曼窗口。

布莱克曼窗是一个锥度形成使用前三项的余弦和。它的设计是为了尽可能减少泄漏。它接近最佳状态,只比凯撒窗稍差一点。

参数
M利息

输出窗口中的点数。如果小于或等于零,则返回空数组。

返回
out恩达雷

最大值规范化为1的窗口(只有当样本数为奇数时,才会显示值1)。

笔记

Blackman窗口定义为

System Message: WARNING/2 (W(n)=0.42-0.5 \cos(2 \pi n/m)+0.08 \cos(4 \pi n/m))

latex exited with error [stdout] This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2018-12-01> (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2018/09/03 v1.4i Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/share/texlive/texmf-dist/tex/latex/anyfontsize/anyfontsize.sty) (/usr/share/texlive/texmf-dist/tex/latex/tools/bm.sty) (./math.aux) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...n/m)+0.08 \cos(4 \pi n/m)\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...n/m)+0.08 \cos(4 \pi n/m)\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...n/m)+0.08 \cos(4 \pi n/m)\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...n/m)+0.08 \cos(4 \pi n/m)\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...n/m)+0.08 \cos(4 \pi n/m)\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...n/m)+0.08 \cos(4 \pi n/m)\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...n/m)+0.08 \cos(4 \pi n/m)\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...n/m)+0.08 \cos(4 \pi n/m)\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...n/m)+0.08 \cos(4 \pi n/m)\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...n/m)+0.08 \cos(4 \pi n/m)\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...n/m)+0.08 \cos(4 \pi n/m)\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...n/m)+0.08 \cos(4 \pi n/m)\end{split} [1] (./math.aux) ) (see the transcript file for additional information) Output written on math.dvi (1 page, 404 bytes). Transcript written on math.log.

大多数对Blackman窗口的引用来自信号处理文献,在那里它被用作平滑值的许多窗口函数之一。它也被称为变迹(意思是“消除脚”,即在采样信号的开始和结束处平滑不连续)或渐缩函数。它被称为“近似最优”的渐缩函数,几乎和凯撒窗一样好。

工具书类

Blackman,R.B.和Tukey,J.W.,(1958)功率谱测量,多佛出版社,纽约。

Oppenheim,A.V.和R.W.Schafer。离散时间信号处理。新泽西州上萨德尔河:普伦蒂斯霍尔,1999年,第468-471页。

实例

>>> import matplotlib.pyplot as plt
>>> np.blackman(12)
array([-1.38777878e-17,   3.26064346e-02,   1.59903635e-01, # may vary
        4.14397981e-01,   7.36045180e-01,   9.67046769e-01,
        9.67046769e-01,   7.36045180e-01,   4.14397981e-01,
        1.59903635e-01,   3.26064346e-02,  -1.38777878e-17])

绘制窗口和频率响应:

>>> from numpy.fft import fft, fftshift
>>> window = np.blackman(51)
>>> plt.plot(window)
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.title("Blackman window")
Text(0.5, 1.0, 'Blackman window')
>>> plt.ylabel("Amplitude")
Text(0, 0.5, 'Amplitude')
>>> plt.xlabel("Sample")
Text(0.5, 0, 'Sample')
>>> plt.show()
../../_images/numpy-blackman-1_00_00.png
>>> plt.figure()
<Figure size 640x480 with 0 Axes>
>>> A = fft(window, 2048) / 25.5
>>> mag = np.abs(fftshift(A))
>>> freq = np.linspace(-0.5, 0.5, len(A))
>>> with np.errstate(divide='ignore', invalid='ignore'):
...     response = 20 * np.log10(mag)
...
>>> response = np.clip(response, -100, 100)
>>> plt.plot(freq, response)
[<matplotlib.lines.Line2D object at 0x...>]
>>> plt.title("Frequency response of Blackman window")
Text(0.5, 1.0, 'Frequency response of Blackman window')
>>> plt.ylabel("Magnitude [dB]")
Text(0, 0.5, 'Magnitude [dB]')
>>> plt.xlabel("Normalized frequency [cycles per sample]")
Text(0.5, 0, 'Normalized frequency [cycles per sample]')
>>> _ = plt.axis('tight')
>>> plt.show()
../../_images/numpy-blackman-1_01_00.png