3.0

3.0 | 1 rating Rate this file 92 downloads (last 30 days) File Size: 3.17 KB File ID: #20221

Auto Peak Finder & Analyser

by Martin Gorjan

 

09 Jun 2008 (Updated 10 Jun 2008)

No BSD License  

Finds peaks, locations, fwhms and area in signal.

Download Now | Watch this File

File Information
Description

Very lean an simple code that automatically finds major peaks, their locations, fwhms and area in a given signal y versus x. Requires no input parameters. The output is a matrix with peaks sorted in rows and following columns:

output = peak No. | peak Y | peak X | peak fwhm | peak area

MATLAB release MATLAB 7.5 (R2007b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
06 Nov 2008 Rose Cory

Am I missing a smooth.m file to run this code?

20 Nov 2008 Martin Barlett

Ditto -- need to add your smooth function or remove this posting!

24 Nov 2008 Theo

smooth works fine, it's a standard function in my matlab. maybe you don't have the right addons

17 Jan 2009 Claus Jeppesen

Theo...what version are you using?? Smooth.m is not a standard file in my matlab version. Maybe you could upload it

25 Jan 2009 Donald

yy = smooth(y) smooths the data in the column vector y using a moving average filter. Results are returned in the column vector yy. The default span for the moving average is 5.

The first few elements of yy are given by

yy(1) = y(1)
yy(2) = (y(1) + y(2) + y(3))/3
yy(3) = (y(1) + y(2) + y(3) + y(4) + y(5))/5
yy(4) = (y(2) + y(3) + y(4) + y(5) + y(6))/5

So if you do not have the MATLAB "Curve Fitting Toolbox", you can make your own smooth function from the above description.

26 Apr 2009 sam s

hi,
when i launch this programm i have an error :

Subscript indices must either be real positive integers or logicals.

Error in ==> autopeak at 75
        y_shift2(ifwhms(1)-1:ifwhms(1)+1) = y_shift2(ifwhms(1)-1:ifwhms(1)+1) + peak(i);

21 Jan 2010 Eric Diaz

The above error is a flaw in the code. The programmer forgot to include a check for what happens during shifting of signal when the peak index is too small or too large (i.e., at the edges of the matrix).

One could include the following code just before the shifting to bypass all peaks near the edges. Just define number of elements to ignore on each edge.

    % check if index too big
    if ipeak >= length(y)-numElements
        break
    end

    % check if index too small
    if ipeak <= numElements
        break
    end

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
dsp Martin Gorjan 22 Oct 2008 10:05:23
peak Martin Gorjan 22 Oct 2008 10:05:23
maximum detection and evaluation Martin Gorjan 22 Oct 2008 10:05:23
height Martin Gorjan 22 Oct 2008 10:05:23
width Martin Gorjan 22 Oct 2008 10:05:23
area Martin Gorjan 22 Oct 2008 10:05:23
fwhm Martin Gorjan 22 Oct 2008 10:05:23
width Julian Romero 07 Feb 2009 20:56:52
maximum detection and evaluation Nate Yoder 05 Oct 2009 19:14:34
fwhm David 28 Dec 2009 17:06:48
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com