【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.17.2.2.7 find_roots
Contents
Description
Find the points with specified height.
Syntax
int find_roots( const vector &vx, const vector &vy, vector &roots, double dBase = 0.0, vector<int> &vnDirection = NULL)
Parameters
- vx
- [input] X-coordinates of input points.
- vy
- [input] Y-coordinates of input points.
- roots
- [output] The collection holds all x at which the corresponding y equals to dBase
- dBase
- [input] The value used to get the collection of roots
- vnDirection
- [output] The direction of crossing
- -1 for pos to neg
- 0 for its derivative dy/dx = 0
- 1 for neg to pos
Return
return the number of roots found, -1 if error occur.
Examples
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]); } } }
Remark
The function used for fitting function parameter initialization.
See Also
Header to Included
origin.h