|
NAG[e01dac] NAG[nag_2d_spline_interpolant] - Interpolating function, bicubic spline interpolant, two variables
|
|
Calling Sequence
e01dac(x, y, f, spline_data, 'mx'=mx, 'my'=my, 'fail'=fail)
nag_2d_spline_interpolant(. . .)
Parameters
|
x - Vector(1..mx, datatype=float[8]);
y - Vector(1..my, datatype=float[8]);
|
|
|
, for ;
|
|
, for .
|
|
|
f - Vector(1.. , datatype=float[8]);
|
|
|
|
spline_data - table;
|
|
|
A Maple table, which should be generated using NAG[Nag_2dSpline], corresponding to the Nag_2dSpline structure.
|
|
On exit: the pointer to which memory of size ny is internally allocated. mu contains the corresponding complete set of knots associated with the variable.
|
|
|
'mx'=mx - integer; (optional)
'my'=my - integer; (optional)
|
|
|
Default value: the first dimension of the arrays x, ythe arrays x, y.
|
|
Constraint: and . .
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_2d_spline_interpolant (e01dac) computes a bicubic spline interpolating surface through a set of data values, given on a rectangular grid in the - plane.
|
|
Error Indicators and Warnings
|
|
"NE_ALLOC_FAIL"
Dynamic memory allocation failed.
"NE_DATA_ILL_CONDITIONED"
An intermediate set of linear equations is singular, the data is too ill-conditioned to compute B-spline coefficients.
"NE_INT_ARG_LT"
On entry, mx must not be less than 4: .
"NE_NOT_STRICTLY_INCREASING"
The sequence x is not strictly increasing: , . The sequence y is not strictly increasing: , .
|
|
Further Comments
|
|
The time taken by nag_2d_spline_interpolant (e01dac) is approximately proportional to .
|
Outline of Method Used
|
|
The process of computing the spline consists of the following steps:
|
use of Gaussian elimination to reduce this system to band triangular form,
|
|
solution of this triangular system for ,
|
|
use of Gaussian elimination to reduce this system to band triangular form,
|
|
solution of this triangular system for and hence .
|
For computational convenience, steps 2 and 3, and likewise steps 6 and 7, are combined so that the formation of and and the reductions to triangular form are carried out one row at a time.
|
|
Evaluation of Computed Spline
|
|
The values of the computed spline at the points , for , may be obtained in the array ff, of length at least n, by the following call:
e02dec (tx, ty, ff, spline, 'm'=n)
where spline_data is a structure of type which is the output argument of nag_2d_spline_interpolant (e01dac).
To evaluate the computed spline on a kx by ky rectangular grid of points in the - plane, which is defined by the co-ordinates stored in , for , and the co-ordinates stored in , for , returning the results in the array fg which is of length at least , the following call may be used:
e02dfc (ky, tx, ty, fg, spline, 'mx'=kx)
where spline_data is a structure of type which is the output argument of nag_2d_spline_interpolant (e01dac). The result of the spline evaluated at grid point is returned in element of the array fg.
|
|
|
|
Examples
|
|
>
|
mx := 7:
my := 6:
spline_data := NAG:-Nag_2dSpline():
x := Vector([1, 1.1, 1.3, 1.5, 1.6, 1.8, 2], datatype=float[8]):
y := Vector([0, 0.1, 0.4, 0.7, 0.9, 1], datatype=float[8]):
f := Vector([1, 1.1, 1.4, 1.7, 1.9, 2, 1.21, 1.31, 1.61, 1.91, 2.11, 2.21, 1.69, 1.79, 2.09, 2.39, 2.59, 2.69, 2.25, 2.35, 2.65, 2.95, 3.15, 3.25, 2.56, 2.66, 2.96, 3.26, 3.46, 3.56, 3.24, 3.34, 3.64, 3.94, 4.14, 4.24, 4, 4.1, 4.4, 4.7, 4.9, 5], datatype=float[8]):
NAG:-e01dac(x, y, f, spline_data, 'mx' = mx, 'my' = my):
|
|
|
See Also
|
|
Anthony G T, Cox M G and Hayes J G (1982) DASL – Data Approximation Subroutine Library National Physical Laboratory
Cox M G (1975a) An algorithm for spline interpolation J. Inst. Math. Appl. 15 95–108
De Boor C (1972) On calculating with B-splines J. Approx. Theory 6 50–62
Hayes J G and Halliday J (1974) The least-squares fitting of cubic spline surfaces to general data sets J. Inst. Math. Appl. 14 89–103
e01 Chapter Introduction.
NAG Toolbox Overview.
NAG Web Site.
|
|