借助scipy.fftfreq()方法,我們可以計算快速傅立葉變換頻率並使用此方法返回變換後的數組。
用法:scipy.fftfreq(n, freq)
Return:返回轉換後的數組。
範例1:
在此示例中,我們可以看到,通過使用scipy.fftfreq()方法,我們能夠計算出快速傅立葉變換頻率並返回變換後的數組。
Python3
# import scipy and numpy
import scipy
import numpy as np
# Using scipy.fftfreq() method
gfg = scipy.fft.fftfreq(5, 1.096)
print(gfg)
輸出:
[ 0. 0.18248175 0.3649635 -0.3649635 -0.18248175]
範例2:
Python3
# import scipy and numpy
import scipy
import numpy as np
# Using scipy.fftfreq() method
gfg = scipy.fft.fftfreq(3, 2.4096)
print(gfg)
輸出:
[ 0. 0.13833555 -0.13833555]
相關用法
- Python scipy.fft()用法及代碼示例
- Python Scipy stats.chi()用法及代碼示例
- Python Scipy stats.f()用法及代碼示例
- Python scipy.rfft()用法及代碼示例
- Python scipy.ifft()用法及代碼示例
- Python scipy.fftshift()用法及代碼示例
注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 scipy.fftfreq() in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。