Mercurial > octave
changeset 28215:ad71b30058ff
griddata3.m: Rewrite documentation.
* griddata3.m: Rewrite documentation to match griddata.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 13 Apr 2020 18:10:45 -0700 |
parents | 0e0e0de09f1e |
children | f5644ccd1df5 |
files | scripts/geometry/griddata3.m |
diffstat | 1 files changed, 24 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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.