Class PeakFinderSavitzkyGolay uses smooth Savitzky-Golay derivatives to find peaks in data and acts as a collection for the found peaks.

Namespace:  CenterSpace.NMath.Core
Assembly:  NMath (in NMath.dll) Version: 5.1.0.0

Syntax

C#
public class PeakFinderSavitzkyGolay : PeakFinderBase, 
	ICloneable
Visual Basic (Declaration)
Public Class PeakFinderSavitzkyGolay _
	Inherits PeakFinderBase _
	Implements ICloneable
Visual C++
public ref class PeakFinderSavitzkyGolay : public PeakFinderBase, 
	ICloneable

Remarks

Typically the degree of the smoothing polynomial is between 3 and 5. The selectivity of the peak finder can be reduced by increasing the SlopeSelectivity. If SlopeSelectivity is set to 0 (default), all found peaks are reported. For proper scaling of the peak abscissa locations, set AbscissaInterval to the data sample interval.

The filter's parameters must satisfied the follow two rules. 1. The filter width must be less than the length of the data. 2. The polynomial degree must be less than the filter width.

Examples

CopyC#
// Build a sinc() function.
double step_size = 0.1;
DoubleVector x = new DoubleVector(5000, 0.01, step_size);
DoubleVector sinc = NMathFunctions.Sin(x) / x;

// Build a peak finder with a width of 6, and 4th degree smoothing polynomial.
PeakFinderSavitzkyGolay pf = new PeakFinderSavitzkyGolay(sinc, 6, 4);
pf.AbscissaInterval = step_size; // Scale abscissa locations.
pf.SlopeSelectivity = 0;         // Return all peaks.
pf.LocatePeaks();                // Locate peaks

// Dump peaks to console.
for (int i = 0; i < pf.NumberPeaks; i++)
  Console.WriteLine("Found peak at = ({0},{1})", pf[i].X, pf[i].Y);

Inheritance Hierarchy

System..::.Object
  CenterSpace.NMath.Core..::.PeakFinderBase
    CenterSpace.NMath.Core..::.PeakFinderSavitzkyGolay

See Also