我想实现带通滤波器以去除噪声频率,然后找到峰值频率

时间:2019-05-05 06:26:50

标签: python numpy scipy

我想过滤频率,然后找到峰值频率。但是我得到的无关值不在频率范围内。我不知道我要去哪里错了。 Link to the project

w = np.fft.fft(data)
freqs = np.fft.fftfreq(len(w))
print(freqs.min(), freqs.max())
# (-0.5, 0.499975)



# I want to implement a bandpass filter here and I have tried this

'''
iw = butter_bandpass_filter(w, low_cut, high_cut, sample_rate, order=10)
w = np.fft.ifft(iw)
'''


# Find the peak in the coefficients
idx = np.argmax(np.abs(w))
freq = freqs[idx]
freq_in_hertz = abs(freq * frate)
print(freq_in_hertz)
# 439.8975

0 个答案:

没有答案