4.16

4.2 | 25 ratings Rate this file 245 Downloads (last 30 days) File Size: 40.01 KB File ID: #4242
image thumbnail

Find Peak Value

by Geng Jun

 

10 Dec 2003 (Updated 12 Dec 2003)

Help you find peak value from a lot of data.

Editor's Notes:

This file was a File Exchange Pick of the Week

| Watch this File

File Information
Description

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.

MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (33)
12 Dec 2003 gu wan

very good

12 Dec 2003 Jiao Shibo

You are Genius!

12 Dec 2003 ma alex

GOOD!

06 Apr 2004 Barney de Villiers

Really Good!
Thanks, It helps me alot!

18 Apr 2004 Keven Chang

Great Job.

03 Jun 2004 Ertu sariaslan

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

21 Jun 2004 James McDonald

It worked perfectly for my example. Thanks!!

20 Jul 2004 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.

28 Jul 2004 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.

23 Nov 2004 Geng Jun

Hi,please contact me using this email address!

02 Feb 2005 ling lin

It saved my time.

22 Feb 2005 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"

31 Aug 2005 Bernard Grundlehner

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

20 Jun 2006 Frederick Lu

Performance need improvements.

15 Dec 2006 Linda Best

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

06 Mar 2007 Rory Gamble

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

21 Apr 2007 Sunil Arya

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

11 Dec 2007 Mukesh V.

this is the best that I found, relavent code

09 Feb 2008 Estella Liu

This works great!! Thank you so much :)

01 Mar 2008 Vlad Vlad

Excellent! Thank you

05 Jun 2008 Rishi Bansal

works like a charm!!!

10 Jun 2008 Vinh Nguyen Quang  
21 Jul 2008 Kristin Golmon

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

27 Aug 2008 shilin guo

working perfect!!

12 Aug 2009 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.

19 Apr 2010 antonio Acampora  
27 May 2010 David Jessop

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

30 Aug 2010 JQZhou

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)));

27 Sep 2010 Alex

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

27 Sep 2010 Alex

Ah never mind... d'oh

02 Feb 2011 Caleb

Great performance.

29 Jun 2011 Kami

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?

29 Jun 2011 Kami

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.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
chemistry Geng Jun 22 Oct 2008 07:10:46
physics Geng Jun 22 Oct 2008 07:10:46
peak value Geng Jun 22 Oct 2008 07:10:46
xray diffraction Geng Jun 22 Oct 2008 07:10:46
data Geng Jun 22 Oct 2008 07:10:46
function Geng Jun 22 Oct 2008 07:10:46
data sasi kuppan 08 Jan 2010 08:22:25
chemistry sasi kuppan 21 Apr 2010 11:10:33
function Markus mayer 26 Apr 2010 04:22:28
chemistry Dheepak Marudhachalam 15 Jun 2010 00:44:10
peak value Dheepak Marudhachalam 15 Jun 2010 00:44:16
peak value kuoping 29 Jun 2010 07:06:17
search peak Jinfeng Li 04 Apr 2011 21:20:15
chemistry wael 26 May 2011 18:00:32
data Le 27 Jun 2011 09:10:05
function Le 27 Jun 2011 09:10:08
peak value Le 27 Jun 2011 09:10:13
3q a de 10 Sep 2011 12:13:02
search peak Alex 23 Sep 2011 17:59:14
data washiqur rahman 25 Dec 2011 12:02:20

Contact us at files@mathworks.com