IAM分析了实验数据,其中电阻RXX的测量是角度PHI的函数,该角度的范围为0至360度,步骤为2度。数据集由两个列组成:
Phi (angle in degrees, from 0 to 360 with step 2°), Rxx (longitudinal resistance)
都只包含实数。
问题:数据集可以通过由两个平方余弦的总和组成的函数进行很好的描述:
Rxx(Phi) = A * cos^2(Pi * (Phi - Phi_0) / 180) + B * cos^2(Pi * (Phi - Phi_0) / 90) + const
为什么FFT无法检测到预期的频率(每360°2个周期和4个周期)?如何解决这个问题?
我正在使用的代码:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from scipy.fft import fft, fftfreq
# import data
data = pd.read_csv("test")
x = data["Phi"].to_numpy()
Rxx = data["Rxx"].to_numpy()
angles = np.deg2rad(x) # convert degrees to radians
dPhi = np.deg2rad(angles[2]-angles[1]) # define angular step
N = len(angles) # number of points
fft_Rxx = fft(Rxx) # compute FFT
freqs = fftfreq(N, dPhi) / (2 * np.pi) # compute frequency
amplitude_Rxx = np.abs(fft_Rxx) # compute magnitude spectrum
# plot results
plt.plot(freqs, amplitude_Rxx)
plt.show()
这里是我数据集的链接:
link这里是对频谱的更好描述。如果您感兴趣的高峰不在这里出现,那么它们可能不存在。