2.1.17.2.7.2 curve_smooth_sg


Description

Smooth the given curve with Savitsky-Golay method.

Syntax

bool curve_smooth_sg( curvebase & cuv, int npts, int nDeg = 2 )

Parameters

cuv
[modify] Curve to be smoothed
npts
[input] number of points to the left and the right to perform the averaging, Total number of points used in smoothing is 2*npts + 1
nDeg
[input] The Polynomail degree. The Savitzky-Golay algorithm is based on performing a least squares linear regression fit of a polynomial of degree nDeg over at least nDeg+1 data points around each point in the spectrum to smooth the data.

Return

true for success

Examples

EX1

//Before you run this example, make sure a curve exists in the active layer
void curve_smooth_sg_ex1()
{
    curve_smooth_sg(Project.ActiveCurveBase(), 3); // 7 pts smoothing
}

Remark

See Also

Header to Include

origin.h

Reference