【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.17.2.4.2 fit_polyline
Contents
Description
Fit the curve to a polyline, where n is the number of sections, and get the average of each section optionally
Syntax
bool fit_polyline( int iSize, double * px, double * py, int n, vector & slope, vector & ave = NULL, vector & cutoff = NULL, vector & xave = NULL )
Parameters
- iSize
- [input] number of input points.
- px
- [input] X-coordinates of input points.
- py
- [input] Y-coordinates of input points.
- n
- [input] Number of segments into which the input data is divided.
- slope
- [output] Collection of slopes for each segment.
- ave
- [output] Collection of the average values of Y-coordinates in each segment.
- cutoff
- [output] Collection of intercepts of each segment.
- xave
- [output] Collection of the average value of X-coordinates in each segment.
Return
Return TRUE for success, else return FALSE.
Examples
EX1
void fit_polyline_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\Linear Fit.dat;"); Worksheet wks = Project.ActiveLayer(); if ( wks ) { Column colX(wks, 0); Column colY(wks, 1); vector vX(colX); vector vY(colY); vector vCutoff, vSlope, vAve, vXAve; int n = 5; int nSize = vX.GetSize(); if ( fit_polyline(nSize, vX, vY, n, vSlope, vAve, vCutoff, vXAve) ) { int nSlopes = vSlope.GetSize(); for ( int ii = 0; ii < nSlopes; ii++ ) { printf("Slope[%d] = %.4lf\n", ii, vSlope[ii]); } } } }
Remark
The function used for fitting function parameter initialization.
See Also
Header to Included
origin.h