Find the points with specified height.
int find_roots( const vector &vx, const vector &vy, vector &roots, double dBase = 0.0, vector<int> &vnDirection = NULL)
return the number of roots found, -1 if error occur.
EX1
void find_roots_ex1() { //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 ) { Column colX(wks, 0); Column colY(wks, 1); vector vX(colX); vector vY(colY); vector vRoots; int nSize = find_roots(vX, vY, vRoots, 5); if ( nSize > 0 ) { ASSERT( vRoots.GetSize() == nSize ); for ( int ii = 0; ii < nSize; ii++ ) printf("vRoots[%d] = %lf\n", ii, vRoots[ii]); } } }
The function used for fitting function parameter initialization.
origin.h