Algorithm to locate local maxima

后端 未结 9 1932
有刺的猬
有刺的猬 2020-12-24 03:24

I have data that always looks something like this:

alt text http://michaelfogleman.com/static/images/chart.png

I need an algorithm to locate the three peaks.

9条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-24 03:36

    Another method is to create what i call a walking slope average. I dont know if there is a name for it but it goes like this, your data set is for example 1000 numbers, you take x[n] +x[n..1234567] numbers say 7 numbers ahaed, take average of first 3 and last 3 use them to find if a line put over them would go up or down.

    When it goes down you passed a mountain peek number, after one such sample keep waiting till it raises again. So only after upwards you track the first moment of going down. And repeat that.

    It will detect tops, and depending on slope line length (7) .. 15 ..33 etc, you also remove noise.

提交回复
热议问题