<<prev file | next file >>    view single page | view frames    summary: fields | routine    details: routine

Interpolation/

spl_incr.pro

Given the arrays X and Y, which tabulate a function (with the X[i] AND Y[i] in ascending order), and given an input value X2, the SPL_INCR function returns an interpolated value for the given values of X2. The interpolation method is based on cubic spline, corrected in a way that interpolated values are also monotonically increasing.

Routine summary

result = pure_concave(x1, x2, y1, y2, der2, x)

result = pure_convex(x1, x2, y1, y2, der2, x)

result = spl_incr(x, y, x2, YP0=YP0, YPN_1=YPN_1)

toppure_concave

result = pure_concave(x1, x2, y1, y2, der2, x)

Return value

y2: f(x2) = y2. Double precision array

Parameters

x1        in required

An n-element (at least 2) input vector that specifies the tabulate points in a strict ascending order.

x2        in required

The input values for which the interpolated values are desired. Its values must be strictly monotonically increasing.

y1        in required

f(x) = y. An n-element input vector that specifies the values of the tabulated function F(Xi) corresponding to Xi. As f is supposed to be monotonically increasing, y values must be monotonically increasing. y can have equal consecutive values.

y2       

der2       

x       

Examples

IDL> y2 = spl_incr(x, y, x2) IDL> n = 100L IDL> x = (dindgen(n))^2 IDL> y = abs(randomn(0, n)) IDL> y[n/2:n/2+1] = 0. IDL> y[n-n/3] = 0. IDL> y[n-n/6:n-n/6+5] = 0. IDL> y = total(y, /cumulative, /double) IDL> x2 = dindgen((n-1)^2) IDL> n2 = n_elements(x2) IDL> print, min(y[1:n-1]-y[0:n-2]) LT 0 IDL> y2 = spl_incr( x, y, x2) IDL> splot, x, y, xstyle = 1, ystyle = 1, ysurx=.25, petit = [1, 2, 1], /land IDL> oplot, x2, y2, color = 100 IDL> c = y2[1:n2-1] - y2[0:n2-2] IDL> print, min(c) LT 0 IDL> print, min(c, max = ma), ma IDL> splot,c,xstyle=1,ystyle=1, yrange=[-.01,.05], ysurx=.25, petit = [1, 2, 2], /noerase IDL> oplot,[0, n_elements(c)], [0, 0], linestyle = 1

Version history

Version

$Id$

History

Sebastien Masson (smasson@lodyc.jussieu.fr): May-Dec 2005

Known issues

Restrictions

It might be possible that y2[i+1]-y2[i] has very small negative values (amplitude smaller than 1.e-6)...

toppure_convex

result = pure_convex(x1, x2, y1, y2, der2, x)

Parameters

x1        in required

An n-element (at least 2) input vector that specifies the tabulate points in a strict ascending order.

x2        in required

The input values for which the interpolated values are desired. Its values must be strictly monotonically increasing.

y1        in required

f(x) = y. An n-element input vector that specifies the values of the tabulated function F(Xi) corresponding to Xi. As f is supposed to be monotonically increasing, y values must be monotonically increasing. y can have equal consecutive values.

y2       

der2       

x       

topspl_incr

result = spl_incr(x, y, x2, YP0=YP0, YPN_1=YPN_1)

Parameters

x       

y       

x2       

Keywords

YP0       

The first derivative of the interpolating function at the point X0. If YP0 is omitted, the second derivative at the boundary is set to zero, resulting in a "natural spline."

YPN_1       

The first derivative of the interpolating function at the point Xn-1. If YPN_1 is omitted, the second derivative at the boundary is set to zero, resulting in a "natural spline."
Produced by IDLdoc 2.0.