File Exchange

image thumbnail

PeakSeek

version 1.2.0.0 (1.54 KB) by Peter O'Connor
Find peaks in vector

22 Downloads

Updated 17 Jan 2011

View Version History

View License

Specify a vecter, a minimum peak separation, and a minimum peak height, and this function will find the peaks.. about 250 times faster than findpeaks would!
try:

t=linspace(0,1,10001);
x=sin(2*pi*20*t)+0.2*sin(2*pi*113*t)+.2*randn(size(t));
p=peakseek(x,10000,1);

Cite As

Peter O'Connor (2021). PeakSeek (https://www.mathworks.com/matlabcentral/fileexchange/26581-peakseek), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (22)

구원 지

works great for my purpose(finding prominent peaks from a noisy signal). Thank you!

Brian Barrett

Its a nice effort, but it does not give the same result as findpeaks. It incorrectly reports peaks in three significant scenaries:
1 - there are consecutive equal data points, on an otherwise rising or falling slope - i.e. not a peak (all but one of the equal datapoints will be treated as a peak)
2 - there are consecutive equal data points at the bottom of a trough (all but the two edge points will be treated as peaks)
3 - there are consecutive equal data points on a peak (all points will be identified, when findpeaks will take only the first occurrence)

I managed to add the logic checks to cover off these scenarios, ,but in the process lost ALL the computational efficiency that this function appeared to provide.

Seva Cherepashkin

does it also work for 2d and 3d array?

dfmkjj jsfjsdlf

Much faster but does not give the same result as findpeaks. Deletes some peeks it should not. Gives incorrect and sub-optimal results.

Kevin Nzeyimana

Thank you for your file, Indeed it gives the same results as findpeaks (in my case) and it is much faster ! Great !

RU LI

Jennifer Popp

Jorge Pena Arancibia

changseop kwon

peakseek is faster than findpeaks 3 times! Nice!!!

Egemen Karabiyik

Myrtle42

Peakseek takes 0.45 s v. 11.27 s for findpeaks, using the same dataset (20716944 x 1 single). 5 stars!

Jey

mlmasmoudi

Yusuke Kadowaki

zxl333

why the number of input parameters is insufficient in my matlab?

John McDowell

Zhaolin Liu

Great job!Doing exactly what I expected!

Mahmoud Hassan

Excellent job.
Very efficient and reducing the calculating time by order of magnitude compared to findpeaks function.

Mathieu

Nice job! So much faster than findpeaks. Findpeaks = 1000 lines of code, you 30 for the same results (in my case).

Dimitris Kaliakmanis

has same problem as findpeaks...It can't detect peaks that exist at edges of vectors. Such a vector for example is [10 9 8 7 6 5] and the only peak it has is it's first value 10,but neither peakseek nor findpeaks can't detect it

Kevin J. Delaney

Nice work!

TideMan

Works well locating peaks in a Fourier spectrum, providing you have smoothed it enough. My only criticism is that the routine only accepts a row vector.

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!