且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在一维阵列中查找峰

更新时间:2023-02-27 13:15:43

您可以尝试使用平滑过滤器对数据进行平滑处理,然后查找之前和之后的值小于当前值的所有值.假设您需要序列中的所有峰.需要使用平滑滤波器的原因是要避免局部最大值.所需的平滑程度取决于数据中存在的噪声.

You could try to smooth the data with a smoothing filter and then find all values where the value before and after are less than the current value. This assumes you want all peaks in the sequence. The reason you need the smoothing filter is to avoid local maxima. The level of smoothing required will depend on the noise present in your data.

一个简单的平滑过滤器将当前值设置为序列中当前值之前和之后的N个值以及要分析的当前值的平均值.

A simple smoothing filter sets the current value to the average of the N values before and N values after the current value in your sequence along with the current value being analyzed.