Institut für Astronomie und AstrophysikAbteilung AstronomieSand 1, D-72076 Tübingen, GermanyNew Address! -- Neue Adresse! |
CSPLINE
Function to evaluate a natural cubic spline at specified data points
Combines the Numerical Recipes functions SPL_INIT and SPL_INTERP
result = cspline( x, y, t, [ DERIV = ])
x - vector of spline node positions, must be monotonic increasing or decreasing y - vector of node values t - x-positions at which to evaluate the spline, scalar or vector INPUT-OUTPUT KEYWORD: DERIV - values of the second derivatives of the interpolating function at the node points. This is an intermediate step in the computation of the natural spline that requires only the X and Y vectors. If repeated interpolation is to be applied to the same (X,Y) pair, then some computation time can be saved by supplying the DERIV keyword on each call. On the first call DERIV will be computed and returned on output.
the values for positions t are returned as the function value If any of the input variables are double precision, then the output will also be double precision; otherwise the output is floating point.
The following uses the example vectors from the SPL_INTERP documentation IDL> x = (findgen(21)/20.0)*2.0*!PI ;X vector IDL> y = sin(x) ;Y vector IDL> t = (findgen(11)/11.0)*!PI ;Values at which to interpolate IDL> plot,x,y,psym=1 ;Plot original grid IDL> oplot, t,cspline(x,y,t),psym=2 ;Overplot interpolated values
The "Numerical Recipes" implementation of the natural cubic spline is used, by calling the intrinsic IDL functions SPL_INIT and SPL_INTERP.
version 1 D. Lindler May, 1989 version 2 W. Landsman April, 1997 Rewrite using the intrinsic SPL_INIT & SPL_INTERP functions Converted to IDL V5.0 W. Landsman September 1997 Work for monotonic decreasing X vector W. Landsman February 1999
[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]