diff scripts/general/gradient.m @ 11587:c792872f8942

all script files: untabify and strip trailing whitespace
author John W. Eaton <jwe@octave.org>
date Thu, 20 Jan 2011 17:35:29 -0500
parents fd0a3ac60b0e
children d5bd2766c640
line wrap: on
line diff
--- a/scripts/general/gradient.m	Thu Jan 20 17:24:59 2011 -0500
+++ b/scripts/general/gradient.m	Thu Jan 20 17:35:29 2011 -0500
@@ -36,21 +36,21 @@
 ##
 ## A constant spacing between two points can be provided by the
 ## @var{s} parameter.  If @var{s} is a scalar, it is assumed to be the spacing
-## for all dimensions. 
+## for all dimensions.
 ## Otherwise, separate values of the spacing can be supplied by
 ## the @var{x}, @dots{} arguments.  Scalar values specify an equidistant
 ## spacing.
 ## Vector values for the @var{x}, @dots{} arguments specify the coordinate for
 ## that
 ## dimension.  The length must match their respective dimension of @var{m}.
-## 
+##
 ## At boundary points a linear extrapolation is applied.  Interior points
 ## are calculated with the first approximation of the numerical gradient
 ##
 ## @example
 ## y'(i) = 1/(x(i+1)-x(i-1)) * (y(i-1)-y(i+1)).
 ## @end example
-## 
+##
 ## If the first argument @var{f} is a function handle, the gradient of the
 ## function at the points in @var{x0} is approximated using central
 ## difference.  For example, @code{gradient (@@cos, 0)} approximates the
@@ -65,7 +65,7 @@
 ## Modified: David Bateman <dbateman@free.fr> Added NDArray support
 
 function varargout = gradient (m, varargin)
-  
+
   if (nargin < 1)
     print_usage ()
   endif
@@ -100,7 +100,7 @@
   if (nargin > 2 && nargin != nd + 1)
     print_usage ()
   endif
-  
+
   ## cell d stores a spacing vector for each dimension
   d = cell (1, nd);
   if (nargin == 1)
@@ -137,7 +137,7 @@
     mr = rows (m);
     mc = numel (m) / mr;
     Y = zeros (size (m), class (m));
-        
+
     if (mr > 1)
       ## Top and bottom boundary.
       Y(1,:) = diff (m(1:2, :)) / d{i}(1);
@@ -186,7 +186,7 @@
     num_points = p0_size (1);
     dim = p0_size (2);
   endif
-  
+
   if (length (varargin) == 0)
     delta = 1;
   elseif (length (varargin) == 1 || length (varargin) == dim)
@@ -198,13 +198,13 @@
   else
     error ("gradient: incorrect number of spacing parameters");
   endif
-  
+
   if (isscalar (delta))
     delta = repmat (delta, 1, dim);
   elseif (!isvector (delta))
     error ("gradient: spacing values must be scalars or a vector");
   endif
-  
+
   ## Calculate the gradient
   p0 = mat2cell (p0, num_points, ones (1, dim));
   varargout = cell (1, dim);