一般来说,我们知道,如果我们在频域中三个函数的傅里叶变换之间存在这种关系:
我们应该在时域中有这种关系:
现在我在 Python 中有这个:
import numpy as np
time = np.genfromtxt('time-data.txt',delimiter=',').T
fft = np.genfromtxt('fft-data.txt',delimiter=',',dtype=np.complex_).T
Z_t = time[0]
Q_t = time[1]
Z_fft = fft[0]
Q_fft = fft[1]
P_fft = fft[2]
#Shows that indeed Z_fft is the Fourier transform of Z_t
assert (np.fft.irfft(Z_fft,n=len(Q_t)) == Z_t).all()
#Shows that indeed Q_fft is the Fourier transform of Q_t
assert (np.fft.irfft(Q_fft,n=len(Q_t)) == Q_t).all()
#Shows that indeed Z_fft = P_fft / Q_fft
assert (np.divide(P_fft,Q_fft) == Z_fft).all()
P_t = np.fft.irfft(P_fft,n=len(Q_t))
P_t_from_convolve = np.convolve(Z_t,Q_t,mode='same')
#Expect to see that P_t = P_t_convolve but it's not the case!
assert (P_t == P_t_from_convolve).all()
有什么理由?
这些是这里的数据文件: