# HG changeset patch # User Rik # Date 1586826645 25200 # Node ID ad71b30058ff8fe8390b5dda4343d3338a7b0019 # Parent 0e0e0de09f1ea9d8dae535f0d309ed669e3de180 griddata3.m: Rewrite documentation. * griddata3.m: Rewrite documentation to match griddata. diff -r 0e0e0de09f1e -r ad71b30058ff scripts/geometry/griddata3.m --- a/scripts/geometry/griddata3.m Mon Apr 13 18:07:28 2020 -0700 +++ b/scripts/geometry/griddata3.m Mon Apr 13 18:10:45 2020 -0700 @@ -28,18 +28,34 @@ ## @deftypefnx {} {@var{vi} =} griddata3 (@var{x}, @var{y}, @var{z}, @var{v}, @var{xi}, @var{yi}, @var{zi}, @var{method}) ## @deftypefnx {} {@var{vi} =} griddata3 (@var{x}, @var{y}, @var{z}, @var{v}, @var{xi}, @var{yi}, @var{zi}, @var{method}, @var{options}) ## -## Generate a regular mesh from irregular data using interpolation. +## Interpolate irregular 3-D source data at specified points. ## -## The function is defined by @code{@var{v} = f (@var{x}, @var{y}, @var{z})}. +## The inputs @var{x}, @var{y}, and @var{z} define the points where the +## function @code{@var{v} = f (@var{x}, @var{y}, @var{z})} is evaluated. The +## inputs @var{x}, @var{y}, @var{z} are either vectors of the same length, or +## if they are of unequal length, then they are expanded to a 3-D grid with +## @code{meshgrid}. The size of the input @var{v} must match the size of the +## original data, either as a vector or a matrix. +## ## The interpolation points are specified by @var{xi}, @var{yi}, @var{zi}. ## -## The interpolation method can be @qcode{"nearest"} or @qcode{"linear"}. -## If method is omitted it defaults to @qcode{"linear"}. +## The optional input interpolation @var{method} can be @qcode{"nearest"} or +## @qcode{"linear"}. When the method is @qcode{"nearest"}, the output @var{vi} +## will be the closest point in the original data (@var{x}, @var{y}, @var{z}) +## to the query point (@var{xi}, @var{yi}, @var{zi}). When the method is +## @qcode{"linear"}, the output @var{vi} will be a linear interpolation between +## the two closest points in the original source data in each dimension. +## If @var{method} is omitted or empty, it defaults to @qcode{"linear"}. ## ## The optional argument @var{options} is passed directly to Qhull when ## computing the Delaunay triangulation used for interpolation. See ## @code{delaunayn} for information on the defaults and how to pass different ## values. +## +## Programming Notes: If the input is complex the real and imaginary parts +## are interpolated separately. Interpolation is based on a Delaunay +## triangulation and any query values outside the convex hull of the input +## points will return @code{NaN}. ## @seealso{griddata, griddatan, delaunayn} ## @end deftypefn @@ -105,3 +121,7 @@ %! vi = griddata3 (x, y, z, v, xi, yi, zi, "nearest"); %! vv = vi - xi.^2 - yi.^2 - zi.^2; %! assert (max (abs (vv(:))), 0.385, 0.1); + +## FIXME: Ideally, there should be BIST tests for input validation. +## However, this function is deprecated in Matlab and it probably isn't worth +## the coding time to work on a function that will be removed soon.