Files
notes_estom/Python/scipy/6fft.md
estomm 73cc328c81 scipy
2020-09-25 22:01:28 +08:00

27 lines
737 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## 傅里叶变换
对时域信号计算傅里叶变换以检查其在频域中的行为。 傅里叶变换可用于信号和噪声处理图像处理音频信号处理等领域。SciPy提供fftpack模块可让用户计算快速傅立叶变换。
以下是一个正弦函数的例子它将用于使用fftpack模块计算傅里叶变换。
## 一维傅里叶变换
```py
#Importing the fft and inverse fft functions from fftpackage
from scipy.fftpack import fft
#create an array with random n numbers
x = np.array([1.0, 2.0, 1.0, -1.0, 1.5])
#Applying the fft function
y = fft(x)
print (y)
```
## 离散余弦变换
```py
from scipy.fftpack import dct
mydict = dct(np.array([4., 3., 5., 10., 5., 3.]))
print(mydict)
```