据我所知,FFT 中的幅度是其相应频率的 10 倍。例如,如果您将 sin(t) 的 FFT 从 0 到 2*pi,则 FFT 将在 0.159 Hz 的频率处达到峰值,相应的幅度为 1.59。但是,当我将 sin(2*t) 添加到 sin(t)--y = sin(t) + sin(2*t) 时,幅度不再是频率的 10 倍。这是为什么?预先感谢您的帮助。
图像并不是那么有用,但 2 个幅度小于它们应该假设的幅度应该是频率的 10 倍。
import math
import numpy as np[enter image description here][1]
import numpy.fft as fft
import matplotlib.pyplot as plt
t = np.linspace(0, 2*math.pi, 1600)
y = np.sin(t) + np.sin(2*t)
plt.plot(t, y)
plt.xlabel('time')
plt.ylabel('height')
plt.show()
fft_power = fft.fft(y)
rfft_power = fft.rfft(y)
sample_spacing = 3.92944672e-03
frequency = fft.fftfreq(len(fft_power), sample_spacing)
real_frequency = fft.rfftfreq(len(fft_power), sample_spacing)
plt.plot(real_frequency.real, rfft_power.real, 'ro')
plt.xlabel('frequency')
plt.ylabel('amplitude')
plt.show()