答案 0 :(得分:0)
将DetectPeaks应用于您的数据。计算二阶导数并决定你的mpd,mph设置。
first_derivative = np.gradient(data)
second_derivative = np.gradient(first_derivative)
ind = detect_peaks(second_derivative, mpd=20,mph=0, show=True)
print(ind)
然后用0或最大值填充数组---
arr = []
for i in range(0,len(n_test)):
for j in ind:
if i == j:
arr.append(n_test[i])
arr.append(0)
plt.plot(arr)
最后,查看其他峰值检测选项 - peak detection overview