本文簡要介紹 python 語言中 scipy.signal.zoom_fft
的用法。
用法:
scipy.signal.zoom_fft(x, fn, m=None, *, fs=2, endpoint=False, axis=-1)#
僅針對 fn 範圍內的頻率計算 x 的 DFT。
- x: 數組
要轉換的信號。
- fn: array_like
給出頻率範圍的長度為 2 的序列 [f1, f2] 或標量,假定範圍為 [0, fn]。
- m: 整數,可選
要評估的點數。默認值為 x 的長度。
- fs: 浮點數,可選
采樣頻率。如果
fs=10
例如,表示 10 kHz,則f1和f2也將以 kHz 為單位。默認采樣頻率為 2,因此f1和f2應在 [0, 1] 範圍內,以保持變換低於奈奎斯特頻率。- endpoint: 布爾型,可選
如果為 True,則 f2 是最後一個樣本。否則,不包括在內。默認為假。
- axis: 整數,可選
計算 FFT 的軸。如果未給出,則使用最後一個軸。
- out: ndarray
轉換後的信號。傅裏葉變換將在點 f1、f1+df、f1+2df、…、f2 處計算,其中 df=(f2-f1)/m。
參數 ::
返回 ::
注意:
選擇默認值使得
signal.zoom_fft(x, 2)
等效於fft.fft(x)
,如果m > len(x)
,則signal.zoom_fft(x, 2, m)
等效於fft.fft(x, m)
。要繪製結果變換的幅度,請使用:
plot(linspace(f1, f2, m, endpoint=False), abs(zoom_fft(x, [f1, f2], m)))
如果需要重複轉換,請使用
ZoomFFT
構造一個專門的轉換函數,無需重新計算常量即可重複使用。例子:
要繪製轉換結果,請使用以下內容:
>>> import numpy as np >>> from scipy.signal import zoom_fft >>> t = np.linspace(0, 1, 1021) >>> x = np.cos(2*np.pi*15*t) + np.sin(2*np.pi*17*t) >>> f1, f2 = 5, 27 >>> X = zoom_fft(x, [f1, f2], len(x), fs=1021) >>> f = np.linspace(f1, f2, len(x)) >>> import matplotlib.pyplot as plt >>> plt.plot(f, 20*np.log10(np.abs(X))) >>> plt.show()
相關用法
- Python SciPy signal.zpk2tf用法及代碼示例
- Python SciPy signal.zpk2sos用法及代碼示例
- Python SciPy signal.czt_points用法及代碼示例
- Python SciPy signal.chirp用法及代碼示例
- Python SciPy signal.residue用法及代碼示例
- Python SciPy signal.iirdesign用法及代碼示例
- Python SciPy signal.max_len_seq用法及代碼示例
- Python SciPy signal.kaiser_atten用法及代碼示例
- Python SciPy signal.oaconvolve用法及代碼示例
- Python SciPy signal.hilbert用法及代碼示例
- Python SciPy signal.ricker用法及代碼示例
- Python SciPy signal.group_delay用法及代碼示例
- Python SciPy signal.cheb2ord用法及代碼示例
- Python SciPy signal.get_window用法及代碼示例
- Python SciPy signal.lfilter用法及代碼示例
- Python SciPy signal.morlet用法及代碼示例
- Python SciPy signal.coherence用法及代碼示例
- Python SciPy signal.dfreqresp用法及代碼示例
- Python SciPy signal.TransferFunction用法及代碼示例
- Python SciPy signal.dbode用法及代碼示例
- Python SciPy signal.residuez用法及代碼示例
- Python SciPy signal.bilinear_zpk用法及代碼示例
- Python SciPy signal.firls用法及代碼示例
- Python SciPy signal.impulse用法及代碼示例
- Python SciPy signal.buttord用法及代碼示例
注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.signal.zoom_fft。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。