PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_interp_2d_scat_eval (e01sb)
Purpose
nag_interp_2d_scat_eval (e01sb) evaluates at a given point the two-dimensional interpolant function computed by
nag_interp_2d_scat (e01sa).
Syntax
Description
nag_interp_2d_scat_eval (e01sb) takes as input the arguments defining the interpolant
of a set of scattered data points
, for
,
as computed by
nag_interp_2d_scat (e01sa),
and evaluates the interpolant at the point
.
If is equal to for some value of , the returned value will be equal to .
If
is not equal to
for any
, the derivatives in
grads will be used to compute the interpolant. A triangle is sought which contains the point
, and the vertices of the triangle along with the partial derivatives and
values at the vertices are used to compute the value
. If the point
lies outside the triangulation defined by the input arguments, the returned value is obtained by extrapolation. In this case, the interpolating function
is extended linearly beyond the triangulation boundary. The method is described in more detail in
Renka and Cline (1984) and the code is derived from
Renka (1984).
nag_interp_2d_scat_eval (e01sb) must only be called after a call to
nag_interp_2d_scat (e01sa).
References
Renka R L (1984) Algorithm 624: triangulation and interpolation of arbitrarily distributed points in the plane ACM Trans. Math. Software 10 440–442
Renka R L and Cline A K (1984) A triangle-based interpolation method Rocky Mountain J. Math. 14 223–237
Parameters
Compulsory Input Parameters
- 1:
– double array
- 2:
– double array
- 3:
– double array
- 4:
– int64int32nag_int array
- 5:
– double array
-
m,
x,
y,
f,
triang and
grads must be unchanged from the previous call of
nag_interp_2d_scat (e01sa).
- 6:
– double scalar
- 7:
– double scalar
-
The point at which the interpolant is to be evaluated.
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
x,
y,
f,
grads. (An error is raised if these dimensions are not equal.)
m,
x,
y,
f,
triang and
grads must be unchanged from the previous call of
nag_interp_2d_scat (e01sa).
Output Parameters
- 1:
– double scalar
-
The value of the interpolant evaluated at the point .
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
Cases prefixed with W are classified as warnings and
do not generate an error of type NAG:error_n. See nag_issue_warnings.
-
-
-
-
On entry, the triangulation information held in the array
triang does not specify a valid triangulation of the data points.
triang may have been corrupted since the call to
nag_interp_2d_scat (e01sa).
- W
-
The evaluation point (
px,
py) lies outside the nodal triangulation, and the value returned in
pf is computed by extrapolation.
-
An unexpected error has been triggered by this routine. Please
contact
NAG.
-
Your licence key may have expired or may not have been installed correctly.
-
Dynamic memory allocation failed.
Accuracy
Computational errors should be negligible in most practical situations.
Further Comments
The time taken for a call of nag_interp_2d_scat_eval (e01sb) is approximately proportional to the number of data points, .
The results returned by this function are particularly suitable for applications such as graph plotting, producing a smooth surface from a number of scattered points.
Example
See
Example in
nag_interp_2d_scat (e01sa).
Open in the MATLAB editor:
e01sb_example
function e01sb_example
fprintf('e01sb example results\n\n');
x = [11.16; 12.85; 19.85; 19.72; 15.91; 0.00; 20.87; 3.45; 14.26; ...
17.43; 22.80; 7.58; 25.00; 0.00; 9.66; 5.22; 17.25; 25.00; ...
12.13; 22.23; 11.52; 15.20; 7.54; 17.32; 2.14; 0.51; 22.69; ...
5.47; 21.67; 3.31];
y = [ 1.24; 3.06; 10.72; 1.39; 7.74; 20.00; 20.00; 12.78; 17.87; ...
3.46; 12.39; 1.98; 11.87; 0.00; 20.00; 14.66; 19.57; 3.87; ...
10.79; 6.21; 8.53; 0.00; 10.69; 13.78; 15.03; 8.37; 19.63; ...
17.13; 14.36; 0.33];
f = [22.15; 22.11; 7.97; 16.83; 15.30; 34.60; 5.74; 41.24; 10.74; ...
18.60; 5.47; 29.87; 4.40; 58.20; 4.73; 40.36; 6.43; 8.74; ...
13.71; 10.25; 15.74; 21.60; 19.31; 12.11; 53.10; 49.43; 3.25; ...
28.63; 5.52; 44.08];
[triang,grads,ifail] = e01sa( ...
x,y,f);
px = [3:3:21];
py = [2:3:17];
for i = 1:6
for j = 1:7
[pf(i,j), ifail] = e01sb( ...
x, y, f, triang, grads, px(j), py(i));
end
end
matrix = 'General';
diag = 'Non-unit';
format = 'F7.2';
title = 'Spline evaluated on a regular mesh (x across, y down):';
chlab = 'Character';
rlabs = cellstr(num2str(py'));
clabs = cellstr(num2str(px'));
ncols = int64(80);
indent = int64(0);
[ifail] = x04cb( ...
matrix, diag, pf, format, title, chlab, ...
rlabs, chlab, clabs, ncols, indent);
e01sb example results
Spline evaluated on a regular mesh (x across, y down):
3 6 9 12 15 18 21
2 43.52 33.91 26.59 22.23 21.15 18.67 14.88
5 40.49 29.26 22.51 20.72 19.30 16.72 12.87
8 37.90 23.97 16.79 16.43 15.46 13.02 9.30
11 38.55 25.25 16.72 13.83 13.08 10.71 6.88
14 47.61 36.66 22.87 14.02 13.44 11.20 6.46
17 41.25 27.62 18.03 12.29 11.68 9.09 5.37
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015