Previous: fitcs Up: ../plot79_f.html Next: fitdin
REAL FUNCTION FITD2 (T, N, X, Y, YP, SIGMA, IT) C$ (Tensioned Spline Derivative Interpolation) C$ This function interpolates the derivative of a curve at a C$ given point using a spline under tension. SUBROUTINE FITC1 C$ should be called earlier to determine certain necessary C$ parameters. C$ C$ On input-- C$ C$ T..........contains a REAL value to be mapped onto the C$ interpolating curve. C$ N..........contains the number of points which were C$ interpolated to determine the curve, C$ X and Y....are arrays containing the ordinates and abcissas C$ of the interpolated points, C$ YP.........is an array with values proportional to the C$ second derivative of the curve at the nodes C$ SIGMA......contains the tension factor (its sign is C$ ignored) C$ IT.........is an INTEGER switch. If IT is not 1, this C$ indicates that the function has been called C$ previously (with N, X, Y, YP, and SIGMA C$ unaltered) and that this value of T exceeds the C$ previous value. With such information the C$ function is able to perform the interpolation C$ much more rapidly. If a user seeks to C$ interpolate at a sequence of points, efficiency C$ is gained by ordering the values increasing and C$ setting IT to the index of the call. If IT is 1 C$ the search for the interval (X(K),X(K+1)) C$ containing T starts with K = 1. C$ C$ The parameters N,X,Y,YP and SIGMA should be input unaltered C$ from the output of FITC1. C$ C$ On output-- C$ C$ FITD2......contains the interpolated derivative value. For C$ T less than X(1), FITD2 is the derivative at the C$ endpoint Y(1), and for T greater than X(N), C$ FITD2 is the derivative at Y(N). Since the C$ derivative of a cubic spline is a quadratic, its C$ second derivative is a constant, and its first C$ derivative is linear. Thus, more satisfactory C$ results can generally be obtained by determining C$ a new spline from the derivative curve, and then C$ interpolating in it with FUNCTION FITC2, since C$ the second derivative is no longer a constant. C$ C$ None of the input parameters are altered. C$ C$ Author: A.K. Cline, "Scalar and Planar Valued Curve Fitting C$ Using Splines Under Tension", Comm. A.C.M. 17, C$ 218-225 (1974). (Algorithm 476). C$ C$ Modifications by Nelson H.F. Beebe, Department of Chemistry C$ Aarhus University, Aarhus, Denmark, to provide a more C$ transportable program, and to compute SINH(X) more C$ accurately than 0.5*(EXP(X)-EXP(-X)) for small arguments. C$ This function has been adapted from FITC2 by replacing the C$ interpolant by its derivative, which modifies only three C$ statements. C$ (03-APR-82)