用法:
cusignal.windows.windows.general_cosine(M, a, sym=True)
餘弦項窗口的通用加權和
- M:int
輸出窗口中的點數
- a:array_like
加權係數序列。這使用以原點為中心的約定,因此這些通常都是正數,而不是交替符號。
- sym:布爾型,可選
當為 True(默認)時,生成一個對稱窗口,用於濾波器設計。當為 False 時,生成一個周期窗口,用於頻譜分析。
參數:
參考:
- 1
A. Nuttall, “Some windows with very good sidelobe behavior,” IEEE Transactions on Acoustics, Speech, and Signal Processing, vol. 29, no. 1, pp. 84-91, Feb 1981. :doi:`10.1109/TASSP.1981.1163506`.
- 2
Heinzel G. et al., “Spectrum and spectral density estimation by the Discrete Fourier transform (DFT), including a comprehensive list of window functions and some new flat-top windows”, February 15, 2002 https://holometer.fnal.gov/GH_FFT.pdf
例子:
Heinzel 說明了一個名為 “HFT90D” 的 flat-top 窗口,其公式為:[2]
其中
由於這使用了從原點開始的約定,為了重現窗口,我們需要將所有其他係數轉換為正數:
>>> HFT90D = [1, 1.942604, 1.340318, 0.440811, 0.043097]
該論文指出,最高旁瓣為 -90.2 dB。通過繪製窗口及其頻率響應來重現圖 42,並以紅色確認旁瓣電平:
>>> from cusignal.windows import general_cosine >>> from cupy.fft import fft, fftshift >>> import cupy as cp >>> import matplotlib.pyplot as plt
>>> window = general_cosine(1000, HFT90D, sym=False) >>> plt.plot(cp.asnumpy(window)) >>> plt.title("HFT90D window") >>> plt.ylabel("Amplitude") >>> plt.xlabel("Sample")
>>> plt.figure() >>> A = fft(window, 10000) / (len(window)/2.0) >>> freq = cp.linspace(-0.5, 0.5, len(A)) >>> response = cp.abs(fftshift(A / cp.abs(A).max())) >>> response = 20 * cp.log10(cp.maximum(response, 1e-10)) >>> plt.plot(cp.asnumpy(freq), cp.asnumpy(response)) >>> plt.axis([-50/1000, 50/1000, -140, 0]) >>> plt.title("Frequency response of the HFT90D window") >>> plt.ylabel("Normalized magnitude [dB]") >>> plt.xlabel("Normalized frequency [cycles per sample]") >>> plt.axhline(-90.2, color='red') >>> plt.show()
相關用法
- Python cusignal.windows.windows.general_gaussian用法及代碼示例
- Python cusignal.windows.windows.general_hamming用法及代碼示例
- Python cusignal.windows.windows.get_window用法及代碼示例
- Python cusignal.windows.windows.gaussian用法及代碼示例
- Python cusignal.windows.windows.hann用法及代碼示例
- Python cusignal.windows.windows.hamming用法及代碼示例
- Python cusignal.windows.windows.bartlett用法及代碼示例
- Python cusignal.windows.windows.chebwin用法及代碼示例
- Python cusignal.windows.windows.tukey用法及代碼示例
- Python cusignal.windows.windows.blackman用法及代碼示例
- Python cusignal.windows.windows.barthann用法及代碼示例
- Python cusignal.windows.windows.triang用法及代碼示例
- Python cusignal.windows.windows.kaiser用法及代碼示例
- Python cusignal.windows.windows.flattop用法及代碼示例
- Python cusignal.windows.windows.nuttall用法及代碼示例
- Python cusignal.windows.windows.bohman用法及代碼示例
- Python cusignal.windows.windows.boxcar用法及代碼示例
- Python cusignal.windows.windows.exponential用法及代碼示例
- Python cusignal.windows.windows.blackmanharris用法及代碼示例
- Python cusignal.windows.windows.cosine用法及代碼示例
- Python cusignal.waveforms.waveforms.chirp用法及代碼示例
- Python cusignal.waveforms.waveforms.gausspulse用法及代碼示例
- Python cusignal.waveforms.waveforms.unit_impulse用法及代碼示例
- Python cusignal.waveforms.waveforms.square用法及代碼示例
- Python cusignal.wavelets.wavelets.ricker用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cusignal.windows.windows.general_cosine。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。