This function evaluates the parameters' value of the Gaussian function:
Where FWHM means Full Width at Half Maximum
double peak_pos( Curve & data, double * pWidth = NULL, double * pBaseline = NULL, double * pArea = NULL, double * pHeight = NULL, double * pCentroid = NULL, bool bHaveBase = TRUE, bool bSortDataFirst = TRUE, int * pErr = NULL, int * pnDir = NULL )
X position of the peak center.
EX1
void peak_pos_ex() { //import data into new worksheet, user may import this data manully. LT_execute("win -t W Origin;"); LT_execute("open -w %(system.path.program$)Samples\Curve Fitting\Gaussian.dat;"); Worksheet wks = Project.ActiveLayer(); if ( wks ) { Curve crv(wks, 0, 1); double dxc, dWidth, dBaseline, dArea, dHeight, dCentroid; int nErr, nPeakDirection; dxc = peak_pos(crv, &dWidth, &dBaseline, &dArea, &dHeight, &dCentroid, TRUE, TRUE, &nErr, &nPeakDirection); printf("Peak's width is %.4lf, height is %.4lf, baseline is %.4lf, center is %.4lf\n", dWidth, dHeight, dBaseline, dxc); } }
This function can be used for fitting function parameter initialization.
origin.h