void MSdIntMC (const double x[], const double y[], int N, const double xi[], double yi[], int Ni)


Interpolate a table of values using a piecewise monotonic cubic interpolant


This routine calculates interpolated values for a function defined by a table of reference data values. The interpolated values are found by passing a piecewise monotonic cubic interpolant through the reference data values. The monotonicity property guarantees that the interpolated data values do not go outside the range of the bracketing reference data values.

The procedure defines the cubic interpolant between any two adjacent reference points in terms of the values and the derivatives at the reference points. The derivatives at the reference points are determined by averaging the inverse slopes of the straight line segments joining the reference points to the left and right of a given reference point. These slope values are changed if necessary to guarantee that the cubic interpolants are monotonic between reference points. For instance a reference point is a local extremum (the slopes of the straight line segments joining reference points on either side of it are of different sign), the slope at that reference point is set to zero. The slope of end points is determined from the slopes of the two straight lines joining the reference points beside the end point.

Subroutine PCHIM, F. N. Fritsch, Lawrence Livermore National Laboratory. F. N. Fritsch and J. Butland, "A method for constructing local monotone piecewise cubic interpolants", SIAM J. Sci. Stat. Comput., vol. 5, pp. 300-304, June 1984.


-> const double x[]
Abscissa values for the reference points. These values must be in increasing order.
-> const double y[]
Ordinate values for the reference points
-> int N
Number of reference points
-> const double xi[]
Abscissa values for the interpolated points. These values must be bounded by x[0] and x[N-1]. The values xi[i] need not be in any particular order, although some efficiency is gained if they are in increasing or decreasing order.
<- double yi[]
Resulting interpolated ordinate values
-> int Ni
Number of interpolated values

Author / revision

P. Kabal / Revision 1.5 2003/11/11

Main Index libtsp