Provided by: plotutils_2.6-10_amd64

**NAME**

spline - interpolate datasets using splines under tension

**SYNOPSIS**

spline[options] [files]

**DESCRIPTION**

splinereads datasets from standard input or from one or more files, and fits a smooth curve (a "spline") through each dataset. An interpolated version of each dataset, consisting of points from the smooth curve, is written to standard output. Unless the-aor-Aoptions are used (see below), each dataset should be a sequence of values for a vector-valued function of a single scalar variable. That is, each dataset should be a sequence of data points, given as alternatingtandyvalues.tis a scalar independent variable, andyis a vector-valued dependent variable. The dimensionality ofyis specified with the-doption (the default dimensionality is 1). Between each data point and the next,tshould increase. An input file may contain more than a single dataset. If an input file is in ASCII format (the default), its datasets should be separated by blank lines. Thetandyvalues of the data points in each dataset may be arranged arbitrarily, so long as they are separated by white space. Besides datasets, an input file may contain any number of comment lines, which should begin with the comment character `#'. Comment lines are ignored. They are not treated as blank, i.e., they do not interrupt a dataset in progress. Options and file names may be interspersed on the command line, but the options are processed before the file names are read. If--is seen, it is interpreted as the end of the options. If no file names are specified, or the file name-is encountered, the standard input is read. The type of interpolation, and the format of the input and output files, may be selected by command-line options.

**OPTIONS**

Interpolation-RelatedOptions-f--filterUse a local interpolation algorithm (the cubic Bessel algorithm), so thatsplinecan be used as a real-time filter. The slope of the interpolating curve at each point in a dataset will be chosen by fitting a quadratic function through that point and the two adjacent points in the dataset. If-fis specified then the-toption, otherwise optional, must be used as well. Also, if-fis specified then the-k,-p, and-Toptions may not be used. If-fisnotspecified, then the default (global) interpolation algorithm will be used.-kk--boundary-conditionkSet the boundary condition parameter for each constructed spline to bek. (The default value is 1.0.) In each of its components, the spline will satisfy the two boundary conditions y"[0]=ky"[1] and y"[n]=ky"[n-1]. Here y[0] and y[1] signify the values of a specified component of the vector-valued dependent variableyat the first two points of a dataset, and y[n-1] and y[n] the values at the last two points. Settingkto zero will yield a "natural" spline, i.e., one that has zero curvature at the two ends of the dataset. The-koption may not be used if-for-pis specified.-nn--no-of-intervalsnSubdivide the interval over which interpolation occurs intonsubintervals. The number of data points computed, and written to the output, will ben+1. The default value fornis 100.-p--periodicConstruct a periodic spline. If this option is specified, theyvalues for the first and last points in each dataset must be equal. The-fand-koptions may not be used if-pis specified.-Ttension--tensiontensionEach interpolating curve will be a spline under tension. This option sets the tension value (the default is 0.0). Iftensionequals zero, the curve will be a piecewise cubic spline. Increasing the tension above zero makes the curve "tighter", and reduces the likelihood of spurious inflection points. That is because between each pair of successive points in a dataset, the curve will satisfy the fourth-order differential equation y""=sgn(tension)*(tension^2)y" in each of its components. Astensionincreases to positive infinity, it will converge to a polygonal line. The-Toption may not be used if-fis specified.-ttmintmax[tspacing]--t-spacingtmintmax[tspacing]For each dataset, set the interval over which interpolation occurs to be the interval betweentminandtmax. Iftspacingis not specified, the interval will be divided into the number of subintervals specified by the-noption. If the-toption is not used, the interval over which interpolation occurs will be the entire range of the independent variable in the dataset. The-toption must always be used if the-foption is used to request filter-like behavior (see above).Format-RelatedOptions-ddimension--y-dimensiondimensionSet the dimensionality of the dependent variableyin the input and output files to bedimension. The default dimension is 1.-Idata-format--input-formatdata-formatSet the data format for the input file(s) to bedata-format, which may be one of the following.aASCII format (the default). Each file is a sequence of floating point numbers, interpreted as thetandycoordinates of the successive data points in a dataset. Ifyisd-dimensional, there will bed+1numbers for each point. Thetandycoordinates of a point need not appear on the same line, and points need not appear on different lines. But if a blank line occurs (i.e., two newlines in succession are seen), it is interpreted as the end of a dataset, and the beginning of the next.fSingle precision binary format. Each file is a sequence of floating point numbers, interpreted as thetandycoordinates of the successive data points in a dataset. Ifyisd-dimensional, there will bed+1numbers for each point. Successive datasets are separated by a single occurrence of the quantity FLT_MAX, which is the largest possible single precision floating point number. On most machines this is approximately 3.4x10^38.dDouble precision binary format. Each file is a sequence of double precision floating point numbers, interpreted as thetandycoordinates of the successive data points in a dataset. Ifyisd-dimensional, there will bed+1numbers for each point. Successive datasets are separated by a single occurrence of the quantity DBL_MAX, which is the largest possible double precision floating point number. On most machines this is approximately 1.8x10^308.iInteger binary format. Each file is a sequence of integers, interpreted as thetandycoordinates of the successive data points in a dataset. Ifyisd-dimensional, there will bed+1numbers for each point. Successive datasets are separated by a single occurrence of the quantity INT_MAX, which is the largest possible integer. On most machines this is 2^31-1.-a[step_size[lower_limit]]--auto-abscissa[step_size[lower_limit]]Automatically generate values fort, the independent variable (the default values ofstep_sizeandlower_limitare 1.0 and 0.0, respectively). Irrespective of data format (`a', `f', `d', or `i'), this option specifies that the values oftare missing from the input file: the dataset(s) to be read contain only values ofy, the dependent variable. So ifyisd-dimensional, there will be onlydnumbers for each point. The increment from eachtvalue to the next will bestep_size, and the firsttvalue will belower_limit. This option is useful, e.g., when interpolating curves rather than functions.-A--auto-dist-abscissaAutomatically generate values fort, the independent variable. This is a variant form of the-aoption. The increment from eachtvalue to the next will be the distance ind-dimensional space between the correspondingyvalues, and the firsttvalue will be 0.0. That is,twill be "polygonal arclength". This option is useful when interpolating curves rather than functions.-Odata-format--output-formatdata-formatSet the data format for the output file to bedata-format. The interpretation ofdata-formatis the same as for the-Ioption. The default is `a', i.e., ASCII format.-Psignificant-digits--precisionsignificant-digitsSet the numerical precision for thetandyvalues in the output file to besignificant-digits. This takes effect only if the output file is written in `a' format, i.e., in ASCII.significant-digitsmust be a positive integer (the default is 6).-s--suppress-abscissaOmit the independent variabletfrom the output file; for each point, supply only the dependent variabley. Ifyisd-dimensional, there will be onlydnumbers for each point, notd+1. This option is useful when interpolating curves rather than functions.InformationalOptions--helpPrint a list of command-line options, and exit.--versionPrint the version number ofsplineand the plotting utilities package, and exit.

**EXAMPLES**

Typingecho001120|splinewill produce on standard output an interpolated dataset consisting of 101 data points. If graphed, this interpolated dataset will yield a parabola. It is sometimes useful to interpolate between a sequence of arbitrarily placed points ind-dimensional space, i.e., to "spline a curve" rather than a function. The-aand-soptions are used for this. For example,echo00101101|spline-d2-a-swill produce on standard output a 101-point dataset that interpolates between the four points (0,0), (1,0), (1,1), and (0,1). The-d2option specifies that the dependent variableyis two-dimensional. The-aoption specifies that thetvalues are missing from the input and should be automatically generated. The-soption specifies that thetvalues should be stripped from the output.

**AUTHORS**

splinewas written by Robert S. Maier (rsm@math.arizona.edu), starting with an earlier version by Rich Murphey (rich@freebsd.org). The algorithms for constructing splines under tension are similar to those used in the FITPACK subroutine library, and are ultimately due to Alan K. Cline (cline@cs.utexas.edu).

**SEE** **ALSO**

"The GNU Plotting Utilities Manual".

**BUGS**

Email bug reports tobug-gnu-utils@gnu.org.