SPLINTERP function
Syntax: |
mout = SPLINTERP(x,y,n)
|
The SPLINTERP
function interpolates the data contained in vector x
,
the independent variable, and vector y
, the dependent variable. There are no
restrictions on x
, it doesn't even need to be increasing. The number of interpolant
locations is given in scalar n
, which must be greater than 1
. The output
of the SPLINTERP
function is a matrix with n
rows and 2
columns. The first column will contain the output locations and the second column the
interpolated values.
Method
The points are first parameterized in terms of normalized arc length. The normalized length of
x
is the real length divided by the range of x
, that is, the maximum
value minus the minimum value. The arclength at a point is approximated by the sum of the lengths
of straight line segments connecting all points up to that point. A spline under tension is
calculated for x
versus arc length and y
versus arc length. The
x
and y
values are interpolated separately and then combined to
form the output interpolant.
Tension
The interpolant is calculated by the method of cubic splines under tension. The tension factor
corresponds to the curviness, and must be greater than zero. If it is close to zero, each
interpolated function is almost a cubic spline and the resulting curve is quite loose.
If the tension is large, then the resultant is almost linear. The tension used is the current value
of TENSION
,
which may be changed with the
SET TENSION
command.