Number of peak values from the plot

조회 수: 1 (최근 30일)
satwick guturu
satwick guturu 2021년 3월 25일
댓글: Star Strider 2021년 3월 26일
I have the peak values for the following graph ..but i need the number of peak values in the plot.
load engine_run.dat
engine_state = engine_run(:,1);
time = engine_run(:,2);
findpeaks(time,engine_state)
xlabel('time')
ylabel('engine state')
title('Find All Peaks')

채택된 답변

Star Strider
Star Strider 2021년 3월 25일
Use findpeaks with outputs:
[pks,locs] = findpeaks(time,engine_state);
The number of peaks will be:
numPeaks = numel(pks)
The ‘locs’ output will be the times they occurred.
  댓글 수: 4
satwick guturu
satwick guturu 2021년 3월 26일
And can you help with this..?
If there are more than two peaks for every five seconds.. then they'll be equal to zero or else 1.
How do i implement this ?
Star Strider
Star Strider 2021년 3월 26일
I would use the diff function on the locs output and then see if any of those values are less than five seconds.
If they are, then using that result catgorize them as either 0 or 1, depending on whatever criteria you are using.

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

추가 답변 (0개)

카테고리

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