Number of peak values from the plot
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
satwick guturu
am 25 Mär. 2021
Kommentiert: Star Strider
am 26 Mär. 2021
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')
0 Kommentare
Akzeptierte Antwort
Star Strider
am 25 Mär. 2021
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 Kommentare
Star Strider
am 26 Mär. 2021
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.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!