你能帮我更正下面的代码吗
在这里,我试图通过计算平均频率来提取心电信号的特征
首先,我用以下代码阅读音频:
Fs, data = read('ecg_file.wav')
数据输出: enter image description here
然后,对数据进行FFT处理
Y = np.abs(rfft(data))
fft的输出: enter image description here
现在,我想应用这个公式,它是平均频率的公式。 enter image description here
根据我阅读的参考资料,M是频率单元的长度。要查找P,我使用以下代码:
power_spectrum = Y**2
我仍然对计算fj的值感到困惑。 你们能帮我纠正上面的代码吗
Numpy有一个很好的操作,可以从傅里叶变换中获取频率值,例如
fftfreq
或rfftfreq
您不需要对numpy数组执行元素级乘法
相关问题 更多 >
编程相关推荐