## functions in spline.i - s

spline

dydx= spline(y, x) -or- yp= spline(dydx, y, x, xp) -or- yp= spline(y, x, xp) computes the cubic spline curve passing through the points (X, Y). With two arguments, Y and X, spline returns the derivatives DYDX at the points, an array of the same length as X and Y. The DYDX values are chosen so that the piecewise cubic function returned by the four argument call will have a continuous second derivative. The X array must be strictly monotonic; it may either increase or decrease. The values Y and the derivatives DYDX uniquely determine a piecewise cubic function, whose value is returned in the four argument form. In this form, spline is analogous to the piecewise linear interpolator interp; usually you will regard it as a continuous function of its fourth argument, XP. The first argument, DYDX, will normally have been computed by a previous call to the two argument spline function. However, this need not be the case; another DYDX will generate a piecewise cubic function with continuous first derivative, but a discontinuous second derivative. For XP outside the extreme values of X, spline is linear (if DYDX1 or DYDX0 keywords were specified, the function will NOT have continuous second derivative at the endpoint). The XP array may have any dimensionality; the result YP will have the same dimensions as XP. If you only want the spline evaluated at a single set of XP, use the three argument form. This is equivalent to: yp= spline(spline(y,x), y, x, xp) The keywords DYDX1 and DYDX0 can be used to set the values of the returned DYDX(1) and DYDX(0) -- the first and last values of the slope, respectively. If either is not specified or nil, the slope at that end will be chosen so that the second derivative is zero there. The function tspline (tensioned spline) gives an interpolation function which lies between spline and interp, at the cost of requiring you to specify another parameter (the tension). Interpreted function, defined at i/spline.i line 10SEE ALSO: interp, tspline

sprime

ypprime= sprime(dydx, y, x, xp) computes the derivative of the cubic spline curve passing through the points (X, Y) at the points XP. The DYDX values will have been computed by a previous call to SPLINE, and are chosen so that the piecewise cubic function returned by the four argument call will have a continuous second derivative. The X array must be strictly monotonic; it may either increase or decrease. Interpreted function, defined at i/spline.i line 309