필터 지우기
필터 지우기

Finding the 'peaks' of a stairway graph

조회 수: 5 (최근 30일)
Job
Job 2023년 9월 13일
댓글: Star Strider 2023년 9월 13일
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
  댓글 수: 3
Christopher Stapels
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?
Job
Job 2023년 9월 13일
@Christopher Stapels The ultimate goal is to have a function place one dot at every step. The picture that I posted with the dots, is what the function findpeaks created.
The bottom sample is indeed the correct representation of what i want.
@Dyuman Joshi My definition for a flat spot or a step would be that the y-value changes (this can be a positive or negative change), while the x-value stays the same for an (adjustable) period of time. At this time I am not able to upload a sample of my dataset, my excuses.

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
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
Job
Job 2023년 9월 13일
이동: Star Strider 2023년 9월 13일
Thanks, the islocalmax function works like a charm!
I am not allowed to share the dataset, otherwise i would have shared.
Star Strider
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 커뮤니티

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by