PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_interp_2d_scat_shep_eval (e01sh)
Purpose
nag_interp_2d_scat_shep_eval (e01sh) evaluates the two-dimensional interpolating function generated by
nag_interp_2d_scat_shep (e01sg) and its first partial derivatives.
Syntax
[
q,
qx,
qy,
ifail] = e01sh(
x,
y,
f,
iq,
rq,
u,
v, 'm',
m, 'n',
n)
[
q,
qx,
qy,
ifail] = nag_interp_2d_scat_shep_eval(
x,
y,
f,
iq,
rq,
u,
v, 'm',
m, 'n',
n)
Description
nag_interp_2d_scat_shep_eval (e01sh) takes as input the interpolant
of a set of scattered data points
, for
, as computed by
nag_interp_2d_scat_shep (e01sg),
and evaluates the interpolant and its first partial derivatives at the set of points
, for
.
nag_interp_2d_scat_shep_eval (e01sh) must only be called after a call to
nag_interp_2d_scat_shep (e01sg).
This function is derived from the function QS2GRD described by
Renka (1988).
References
Renka R J (1988) Algorithm 660: QSHEP2D: Quadratic Shepard method for bivariate interpolation of scattered data ACM Trans. Math. Software 14 149–150
Parameters
Compulsory Input Parameters
- 1:
– double array
- 2:
– double array
- 3:
– double array
-
m,
x,
y and
f must be the same values as were supplied in the preceding call to
nag_interp_2d_scat_shep (e01sg).
- 4:
– int64int32nag_int array
-
liq, the dimension of the array, must satisfy the constraint
.
Must be unchanged from the value returned from a previous call to
nag_interp_2d_scat_shep (e01sg).
- 5:
– double array
-
lrq, the dimension of the array, must satisfy the constraint
.
Must be unchanged from the value returned from a previous call to
nag_interp_2d_scat_shep (e01sg).
- 6:
– double array
- 7:
– double array
-
The evaluation points
, for .
Optional Input Parameters
- 1:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
x,
y,
f. (An error is raised if these dimensions are not equal.)
m,
x,
y and
f must be the same values as were supplied in the preceding call to
nag_interp_2d_scat_shep (e01sg).
- 2:
– int64int32nag_int scalar
-
Default:
the dimension of the arrays
u,
v. (An error is raised if these dimensions are not equal.)
, the number of evaluation points.
Constraint:
.
Output Parameters
- 1:
– double array
-
The values of the interpolant at
, for
. If any of these evaluation points lie outside the region of definition of the interpolant the corresponding entries in
q are set to the largest machine representable number (see
nag_machine_real_largest (x02al)), and
nag_interp_2d_scat_shep_eval (e01sh) returns with
.
- 2:
– double array
- 3:
– double array
-
The values of the partial derivatives of the interpolant
at
, for
. If any of these evaluation points lie outside the region of definition of the interpolant, the corresponding entries in
qx and
qy are set to the largest machine representable number (see
nag_machine_real_largest (x02al)), and
nag_interp_2d_scat_shep_eval (e01sh) returns with
.
- 4:
– 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, | , |
or | , |
or | , |
or | . |
-
-
Values supplied in
iq or
rq appear to be invalid. Check that these arrays have not been corrupted between the calls to
nag_interp_2d_scat_shep (e01sg) and
nag_interp_2d_scat_shep_eval (e01sh).
- W
-
At least one evaluation point lies outside the region of definition of the interpolant. At all such points the corresponding values in
q,
qx and
qy have been set to the largest machine representable number (see
nag_machine_real_largest (x02al)).
-
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 to
nag_interp_2d_scat_shep_eval (e01sh) will depend in general on the distribution of the data points. If
x and
y are approximately uniformly distributed, then the time taken should be only
. At worst
time will be required.
Example
See
Example in
nag_interp_2d_scat_shep (e01sg).
Open in the MATLAB editor:
e01sh_example
function e01sh_example
fprintf('e01sh 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];
nw = int64(0);
nq = int64(0);
[iq, rq, ifail] = e01sg(x, y, f, nw, nq);
u = [20.00; 6.41; 7.54; 9.91; 12.30];
v = [ 3.14; 15.44; 10.69; 18.27; 9.22];
[q, qx, qy, ifail] = e01sh(x, y, f, iq, rq, u, v);
fprintf('Interpolated values Q and its derivatives at (u,v)\n');
fprintf(' u v q qx qy\n');
for i = 1:size(u,1)
fprintf('%7.2f%7.2f%7.2f%7.2f%7.2f\n', u(i), v(i), q(i), qx(i), qy(i));
end
e01sh example results
Interpolated values Q and its derivatives at (u,v)
u v q qx qy
20.00 3.14 15.89 -1.28 -0.63
6.41 15.44 34.05 -3.62 -3.56
7.54 10.69 19.31 -2.84 0.81
9.91 18.27 13.68 -1.59 -4.71
12.30 9.22 14.56 -0.68 -0.78
PDF version (NAG web site
, 64-bit version, 64-bit version)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015