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