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:
OPTIONAL INPUTS:
OUTPUTS:
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
Examples
See Also
localmaxima, savgol
< pcrengine | peakfunction > |