changeset 14370:fbdee844550c

griddatan.m: Restore ability to pass options to underlying Qhull * griddatan.m: Restore ability to pass options to underlying Qhull. Update docstring. Update input validation.
author Rik <octave@nomad.inbox5.com>
date Thu, 16 Feb 2012 14:17:26 -0800
parents 932ba2bb9060
children 079e6f3a0977
files scripts/geometry/griddatan.m
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/geometry/griddatan.m	Thu Feb 16 16:17:06 2012 -0500
+++ b/scripts/geometry/griddatan.m	Thu Feb 16 14:17:26 2012 -0800
@@ -17,7 +17,9 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {@var{yi} =} griddatan (@var{x}, @var{y}, @var{xi}, @var{method}, @var{options})
+## @deftypefn  {Function File} {@var{yi} =} griddatan (@var{x}, @var{y}, @var{xi})
+## @deftypefnx {Function File} {@var{yi} =} griddatan (@var{x}, @var{y}, @var{xi}, @var{method})
+## @deftypefnx {Function File} {@var{yi} =} griddatan (@var{x}, @var{y}, @var{xi}, @var{method}, @var{options})
 ##
 ## Generate a regular mesh from irregular data using interpolation.
 ## The function is defined by @code{@var{y} = f (@var{x})}.
@@ -25,16 +27,18 @@
 ##
 ## The interpolation method can be @code{"nearest"} or @code{"linear"}.
 ## If method is omitted it defaults to @code{"linear"}.
-## @seealso{griddata, delaunayn}
+## 
+## 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.
+## @seealso{griddata, griddata3, delaunayn}
 ## @end deftypefn
 
 ## Author: David Bateman <dbateman@free.fr>
 
-function yi = griddatan (x, y, xi, method, varargin)
+function yi = griddatan (x, y, xi, method = "linear", varargin)
 
-  if (nargin == 3)
-    method = "linear";
-  endif
   if (nargin < 3)
     print_usage ();
   endif
@@ -46,13 +50,12 @@
   [m, n] = size (x);
   [mi, ni] = size (xi);
 
-  if (n != ni || size (y, 1) != m || size (y, 2) != 1)
+  if (n != ni || rows (y) != m || columns (y) != 1)
     error ("griddatan: dimensional mismatch");
   endif
 
   ## triangulate data
-  ## tri = delaunayn(x, varargin{:});
-  tri = delaunayn (x);
+  tri = delaunayn (x, varargin{:});
 
   yi = NaN (mi, 1);