PLS_Toolbox Documentation: peakfind< pcrengine peakfunction >

peakfind

Purpose

Automated identification of peaks.

Synopsis

 

[i0,iw] = peakfind(x,width,tolfac,w,options)

[i0,iw] = peakfind(x,width,options)

Description

Given a set of measured traces (x) PEAKFIND attempts to find the location of the peaks. Different algorithms are available and each is discussed in the Algorithm Section.

INPUTS:

                            x   =  matrix of measured traces. Each  row of (x) is an individual trace with potential peaks.

                    width   = number of points in Savitzky-Golay filter.

OPTIONAL INPUTS:

                  tolfac   = tolerance on the estimated residuals, peaks heights are estimated to be > tolfac*residuals {default: tolfac = 3}.

                            w   = odd scalar window width for determining local maxima {default: w = 3} (see LOCALMAXIMA).

                options   = discussed below in the Options Section.

OUTPUTS:

                          i0   =  cell array with each cell containing the indices of the location of the major peaks for each of the  traces.

                          iw   =  cell array with each cell containing the indices of the location of the windows containing each peak in (i0). (If not included in the output argument list, it is not calculated and the algorithm is slightly faster.) .

Algorithm

Each peak finding algorithm uses the smoothed and second derivative data (see SAVGOL) and an estimate of the residuals. The smoothed and second derivative are estimated as:

d0 = savgol(x,width,2,0);

d2 = savgol(x,width,2,2);

The residuals are defined for the  row/trace as

residuals = sqrt(mean((x(i,:)-d0(i,:)).^2));

For options.algorithm = 'd0', locates a candidate set of peaks (pks) by identifying local maxima (within the specified window size) in the smoothed data:

pks = localmax(d0(i,:),w);

Next, the input (tolfac) is used to estimate two thresholds (tol0) and (tol2) using the smoothed and second derivative data:

tol0 = tolfac*sqrt(mean((x(i,:)-d0(i,:)).^2));

tol2 = tol0*(max(d2(i,:))-min(d2(i,:)))/ …

            (max(d0(i,:))-min(d0(i,:)));

Finally, the set of major peaks are selected from the initial candidate set of peaks . To be accepted, the value of d0 and d2 at the peak location must surpass the estimated noise level of both d0 and d2 by the tolerance factor (tolfac).

i0{i} = pks(d0(i,pks)>tol0 & d2(i,pks)<-tol2);

For options.algorithm = 'd2', the algorithm operates similarly to what is described for d0 except that it locates candidate peaks as the local maxima on the second derivative data and to be accepted, a peak must only surpass the estimated noise level of d2 by the tolerance factor. That is, d0 is not considered at all in the calculation except to estimate the noise level.

For options.algorithm = 'd2r', as with 'd2', 'd2r' locates peaks in the second derivative data, d2, but selects the final set as those peaks which have a "relative" height (difference between closest d2 peak valley and d2 peak top) which surpasses the estimated noise level of d2 by the tolerance factor, tolfac.

Options

options = structure array with the following fields:

          name:  'options', name indicating that this is an options structure.

      algorithm:   [ {'d0'} | 'd2' | 'd2r' ] selects the peak finding algorithm (see the Algorithm Section for a description of each).

Examples

 

See Also

localmaxima, savgol


< pcrengine peakfunction >