find peak in data

조회 수: 25 (최근 30일)
Lior Genfon
Lior Genfon 2021년 12월 18일
댓글: Star Strider 2021년 12월 18일
hello i need to find peaks in this graph how can i do this

답변 (1개)

Star Strider
Star Strider 2021년 12월 18일
Use either the findpeaks or islocalmax funcitons. The islocalmax function returns a logical vector, so to get the numerical indices from it, use the find function.
.
  댓글 수: 2
Lior Genfon
Lior Genfon 2021년 12월 18일
i try this function i need only the top and buttom peaks all the peaks in the middle dont need to consedire
Star Strider
Star Strider 2021년 12월 18일
I do not have your data, so I cannot write code that applies specifically to it.
Both functions have appropraite name-value pair arguments to select only the highest (or lowest) peak in a particular region. For findpeaks it is 'MinPeakDistance', and for islocalmax and islocalmin it is 'MinSeparation'.
To get the negative peaks with findpeaks, negate the first argument, then negate again to get the actual values —
[pks,plocs] = findpeaks(y, ''MinPeakDistance',100) % Peaks
[vys,vlocs] = findpeaks(-y, ''MinPeakDistance',100) % Peaks
PeakVals = pks;
ValyVals = -vlys;
Use the correct values for 'MinPeakDistance'. The location index vectors retain their validity regardless.
.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by