当前位置: 首页>>编程示例 >>用法及示例精选 >>正文


Python scipy.fft.idct()用法及代码示例

借助scipy.fft.idct()方法,我们可以通过选择不同类型的序列来计算逆离散余弦变换,并使用此方法返回变换后的数组。

用法:

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

返回值:它将返回逆变换的数组。

范例1:在此示例中,我们可以看到,通过使用scipy.fft.idct()方法,我们可以通过默认选择2种不同类型的序列来获得逆离散余弦逆变换。



Python3

# import scipy 
from scipy import fft 
  
# Using scipy.fft.idct() method 
gfg = fft.idct([0.1, 2.1, 0.3, 4.2]) 
  
print(gfg)

输出:

[ 0.95238737 -0.80969772  0.7286317  -0.82132135]

范例2:

Python3

# import scipy 
from scipy import fft 
  
# Using scipy.fft.idct() method 
gfg = fft.idct([0.95238737, -0.80969772, 0.7286317, -0.82132135], 4) 
  
print(gfg)

输出:

[0.12635568 0.17287895 0.19562573 0.51175513]

相关用法


注:本文由纯净天空筛选整理自Jitender_1998大神的英文原创作品 Python – scipy.fft.idct() method。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。