當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python scipy.fft.idst()用法及代碼示例

借助scipy.fft.idst()方法,我們可以通過選擇不同類型的序列來計算離散正弦變換的逆,並使用此方法返回變換後的數組。

用法:

scipy.fft.idst(x, type=2)

返回值:它將返回轉換後的數組。

範例1:在此示例中,我們可以看到,通過使用scipy.fft.idst()方法,我們可以通過默認選擇不同類型的序列來獲得離散正弦變換的逆函數(即2)。

Python3



# import scipy 
from scipy import fft 
  
# Using scipy.fft.idst() method 
gfg = fft.idst([1, 2, 3, 4]) 
  
print(gfg)

輸出:

[ 1.6421339  -0.2024893   0.09040392 -0.06497288]

範例2:

Python3

# import scipy 
from scipy import fft 
  
# Using scipy.fft.idst() method 
gfg = fft.idst([-6, 5, -4, 3, -2, 1], 3) 
  
print(gfg)

輸出:

[-0.02311678  0.00 -0.11785113  0.000 -1.20162809 -3.5]

相關用法


注:本文由純淨天空篩選整理自Jitender_1998大神的英文原創作品 Python – scipy.fft.idst() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。