File Exchange

image thumbnail

Find Peak Value

version 1.0 (40 KB) by

Help you find peak value from a lot of data.

34 Downloads

Updated

No License

Editor's Note: This file was a File Exchange Pick of the Week

It's a simple function. Can help you find peak value from a lot of datas. It contains some demos.

It's my first time to submit file, thanks for your using.

Comments and Ratings (39)

Nur Muzammil

How do we modify this code to just find the minima/ valley point and ignore the maxima? Thank you.

AMAL ALGEDIR

how I define the number of peaks that I need the function to return. For example if I only need the first three peaks of data?

haier

haier (view profile)

Tharindu

Thanks, It works great!

Jesse Sipple

Has anyone had any trouble finding the peaks for a vector that has both positive and negative values? Does not seem to be working with that.

Kami

Kami (view profile)

About the input parameter,"Range":
Range is a 4-element vector:
[Xmin, Xmax, Ymin, Ymax]
Xmin: the lower x boundary of region of interest(ROI).
Xmax: the upper x boundary of ROI
Ymin and Ymax are the same as Xmin and Xmax.
For example,
t=fpeak(A,B,30,[23,90,700,inf]);
means:
find the peaks whose x are between 23 and 90 and their values is between 700 and inf.

Kami

Kami (view profile)

I would be grateful if you put some explanation about the inputs. What is the input "Range"? and why is it a four-element vector?

Caleb

Caleb (view profile)

Great performance.

Alex

Alex (view profile)

Ah never mind... d'oh

Alex

Alex (view profile)

Sorry if this is a dumb question, but where is this getPeak function that is called within this function?? I tried finding it on File Exchange and am not getting anything...

Thanks

JQZhou

JQZhou (view profile)

There is a bug in this program. when the peak/valley contains more than 1 point with same value, this program will just ignore this peak/valley.

correction:
replace
tP=(sum(y(top:bottom)>=y(i))==1);
bP=(sum(y(top:bottom)<=y(i))==1);
with
tP=(y(ii)==max(y(top:bottom)));
bP=(y(ii)==min(y(top:bottom)));

David Jessop

Poorly explained, poor performance for large data sets and requires too much parameter tweaking in order to find peaks.

john Chandler

it doesn't work.

Change line 9 in ma.m to
t=fpeak(A,B,30,[0,90,100,inf]);

and you will see that it picks peaks and valleys, both.

shilin guo

working perfect!!

Kristin Golmon

Doesn't work when there are two data matching values at the top of a peak. Other than that, perfect.

Vinh Nguyen Quang

Rishi Bansal

works like a charm!!!

Vlad Vlad

Excellent! Thank you

Estella Liu

This works great!! Thank you so much :)

Mukesh V.

this is the best that I found, relavent code

Sunil Arya

I found a very good m code to pick up the peak data.
Thankyou

Rory Gamble

I would really like to see a version of this that does functions of two wariables, eg extreme.m/extreme2.m

Linda Best

i found extreme.m is geat and also find peaks from surface: extreme2.m! But this was the first i used

Frederick Lu

Performance need improvements.

Bernard Grundlehner

Too slow on large sets of data. I prefer peakdetect.m

Alexandre Chirokov

I added small code (see below) to the getPeak function, now it works even better on my data.

if abs(y(i)-avg)<delta
p=[nan,nan];
return;
end
delta = std(y)
avg = mean(y) it can be local std and mean with window equal to +-several values of "s"

ling lin

It saved my time.

Geng Jun

Hi,please contact me using this email address!

Tom Wang

Not sure if I'm using this correctly but I'm not getting accurate peaks at all. My call to the function is fpeak(1:129, data, 2). "data" has 129 values. I'm getting values of 4.0 0 next to 5.0 1, and 3.0 2. Any suggestions would be appreciated.

Peng Wang

I just need a function to find peaks. Thank you so much to solve my problem and save my time. It works great. The sensitivity is actually the half-width of the peak. A point is defined as a peak if its value is biger than that of any s points ahead and s points behind.

James McDonald

It worked perfectly for my example. Thanks!!

Ertu sariaslan

Thanks for solving my Problem !!!
But I dont understand the sensitivity, can anybody help me ???

Keven Chang

Great Job.

Barney de Villiers

Really Good!
Thanks, It helps me alot!

ma alex

GOOD!

Jiao Shibo

You are Genius!

gu wan

very good

MATLAB Release
MATLAB 6.5 (R13)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video