How to find first two largest peaks with sample location
25 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Muhammad Usman Gul
am 6 Feb. 2020
Kommentiert: Bhaskar R
am 6 Feb. 2020
Please let me know, how to find its two highest peaks along with its samples information too.
0 Kommentare
Akzeptierte Antwort
Bhaskar R
am 6 Feb. 2020
d = rand(100,1); % assumed data
[vals,loc] = maxk(d,2); % first two peaks(mnaximum values) sample values and locations
plot(d); hold on; % plot original samples
plot(loc,vals,'rv', 'MarkerFaceColor', 'r'); % plot peak values
2 Kommentare
Bhaskar R
am 6 Feb. 2020
Yeah, I got you. Use findpeaks to get all peak values of the samples
d = rand(100,1); % assumed data
[vals,locs] = findpeaks(d);
[val,loc] = maxk(vals,2); % first two peaks(mnaximum values) sample values and locations
plot(d); hold on; % plot original samples
plot(locs(loc),val,'rv', 'MarkerFaceColor', 'r'); % plot peak values
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!