数学形式
FFT 求频谱相关
FFT 就是快速 DFT。你的数据采样间隔 ,采样 次,采样周期
做 FFT 并绘制,你将得到最大频率 ,基准频率(分度值)为 的频谱:
1N = len(x) # Number of samples2T = 1.0 / 200.0 # Sampling interval (1/200 Hz)3yf = np.fft.fft(x) # Compute the FFT 频率分量4xf = np.fft.fftfreq(N, T)[:N // 2] # 获取实际频率作为横轴5
6# Plot the frequency spectrum7plt.plot(xf, 2.0 / N * np.abs(yf[:N // 2])) # Normalize and plotref: https://zhuanlan.zhihu.com/p/620462217 含有 FFT 算法证明
verified using sin wave (generate + fft) on 24.8.21