Back to library index.

Package spline (in spline.i) -

Index of documented functions or symbols:

spline

DOCUMENT 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).

SEE ALSO: interp, tspline

sprime

DOCUMENT 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.

tspline

DOCUMENT d2ydx2= tspline(tension, y, x)
      or     yp= tspline(tension, d2ydx2, y, x, xp)
      or     yp= tspline(tension, y, x, xp)
  computes a tensioned spline curve passing through the points (X, Y).

  The first argument, TENSION, is a positive number which determines
  the "tension" in the spline.  In a cubic spline, the second derivative
  of the spline function varies linearly between the points X.  In the
  tensioned spline, the curvature is concentrated near the points X,
  falling off at a rate proportional to the tension.  Between the points
  of X, the function varies as:
        y= C1*exp(k*x) + C2*exp(-k*x) + C3*x + C4
  The parameter k is proportional to the TENSION; for k->0, the function
  reduces to the cubic spline (a piecewise cubic function), while for
  k->infinity, the function reduces to the piecewise linear function
  connecting the points.  The TENSION argument may either be a scalar
  value, in which case, k will be TENSION*(numberof(X)-1)/(max(X)-min(X))
  in every interval of X, or TENSION may be an array of length one less
  than the length of X, in which case the parameter k will be
  abs(TENSION/X(dif)), possibly varying from one interval to the next.
  You can use a variable tension to flatten "bumps" in one interval
  without affecting nearby intervals.  Internally, tspline forces
  k*X(dif) to lie between 0.01 and 100.0 in every interval, independent
  of the value of TENSION.  Typically, the most dramatic variation
  occurs between TENSION of 1.0 and 10.0.

  With three arguments, Y and X, spline returns the derivatives D2YDX2 at
  the points, an array of the same length as X and Y.  The D2YDX2 values
  are chosen so that the tensioned spline function returned by the five
  argument call will have a continuous first derivative.

  The X array must be strictly monotonic; it may either increase or
  decrease.

  The values Y and the derivatives D2YDX2 uniquely determine a tensioned
  spline function, whose value is returned in the five argument form.
  In this form, tspline is analogous to the piecewise linear interpolator
  interp; usually you will regard it as a continuous function of its
  fifth (or fourth) argument, XP.

  The XP array may have any dimensionality; the result YP will have
  the same dimensions as XP.

  The D2YDX2 argument will normally have been computed by a previous call
  to the three argument tspline function.  If you will be computing the
  values of the spline function for many sets of XP, use this five
  argument form.

  If you only want the tspline evaluated at a single set of XP, use the
  four argument form.  This is equivalent to:
       yp= tspline(tension, tspline(tension,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).

SEE ALSO: interp, tspline