Code covered by the BSD License  

Highlights from
tolpk - peaks raising by a tolerance

Be the first to rate this file! 1 Download (last 30 days) File Size: 1.93 KB File ID: #22662
image thumbnail

tolpk - peaks raising by a tolerance

by Miroslav Balda

 

12 Jan 2009

The function finds all peaks raising above adjacent valeys by a tolerance

| Watch this File

File Information
Description

TOLPK finds all peaks raising above adjacent valeys from both sides by a given tolerance. The function tests differences between peaks and adjacent valeys of an arbitrary function and returns indeces of peaks raising above neighbouring valeys more than an allowed tolerance. The function finds at least one highest peak even in case of small ripple (noise) over all function values.

Call of the function:
     I = tolpk(tol,y);
Input arguments:
     tol = Tolerance for skipping over small peaks
                >0 tolerance in units of y,
                <0 tolerance in percents of the maximum peak of y
      y = samples of the function y(x) for monotone sequence of x,
      x = argument of the function y(x).
                If no x is given, vector x = 1:length(y) will be generated.
Output parameter:
      yp = vector of peaks with relative heights greater than tol, and maximum peak including
      xp = argument values of yp.
 
Example:
      tol = -5; % tol = 5% of y_{max}
      x = 0:.1:2*pi;
      y = sin(x)+.15*cos(51.23*x)+.07*sin(141*x)+1;
      plot(x,y); hold on, grid on
      [yp,xp] = tolpk(tol,y,x); % coordinates of accepted peaks
      plot(xp,yp,'*r')
      hold off

MATLAB release MATLAB 7.3 (R2006b)
Other requirements function extr.m from FEX Id. 10272. A Testing function testpk needs the function inp.m from FEX, Id. 9033.
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
peaks Miroslav Balda 12 Jan 2009 16:36:37
tolerance Miroslav Balda 12 Jan 2009 16:36:37

Contact us at files@mathworks.com