Finding the 'peaks' of a stairway graph
5 ビュー (過去 30 日間)
古いコメントを表示
Good afternoon,
I have a question regarding a stairway graph (I am not sure if that is the correct term, but I lack a better term). For a project, I want to find the peaks, or flat spots of the graph that I posted below. This is a sample of a much bigger dataset. The values of this graph are stored in a big Nx2 matrix. I tried the function 'findpeaks' but this delivered very inconsistent results, sometimes it gives multiple peaks where there should be only one, and sometimes it gives none where there should be one. Can anyone point me in the right direction where i can calculate/find the peaks?
Thanks in advance
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1480871/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1480876/image.png)
3 件のコメント
Christopher Stapels
2023 年 9 月 13 日
For some of the steps you have no points, and some have several. How do you decide when to put multiple dots an a single platform (step)? A flat area doesnt have a local maximum, but perhaps you are showing us a very far out view of the data?
Or is that sample at teh bottom not a correct representation of what you want?
採用された回答
Star Strider
2023 年 9 月 13 日
移動済み: Star Strider
2023 年 9 月 13 日
It would really help to have your data (or at least a representative sample of it that demonstrates the problem you want to solve).
I am not certain what result you want.
An alternative to findpeaks that could work is the islocalmax function with the 'FlatSelection' name-value pair, perhaps including the 'MinProminence' or 'MinSeparation' name-value pairs, or a combination of them. The findpeaks function will work, however it is intended for signal processing applications. The islocalmax function is more general.
2 件のコメント
Star Strider
2023 年 9 月 13 日
My pleasure!
If my Answer helped you solve your problem, please Accept it!
(I moved my Comment to this Answer, and your Comment as a Comment to it.)
.
その他の回答 (0 件)
コミュニティ
その他の回答 ThingSpeak コミュニティ
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!