


% -*- texinfo -*-
% @deftypefn {Function File} {} diff (@var{x}, @var{k}, @var{dim})
% If @var{x} is a vector of length @var{n}, @code{diff (@var{x})} is the
% vector of first differences
% @tex
% $x_2 - x_1, \ldots{}, x_n - x_{n-1}$.
% @end tex
% @ifnottex
% @var{x}(2) - @var{x}(1), @dots{}, @var{x}(n) - @var{x}(n-1).
% @end ifnottex
%
% If @var{x} is a matrix, @code{diff (@var{x})} is the matrix of column
% differences along the first non-singleton dimension.
%
% The second argument is optional. If supplied, @code{diff (@var{x},
% @var{k})}, where @var{k} is a non-negative integer, returns the
% @var{k}-th differences. It is possible that @var{k} is larger than
% then first non-singleton dimension of the matrix. In this case,
% @code{diff} continues to take the differences along the next
% non-singleton dimension.
%
% The dimension along which to take the difference can be explicitly
% stated with the optional variable @var{dim}. In this case the
% @var{k}-th order differences are calculated along this dimension.
% In the case where @var{k} exceeds @code{size (@var{x}, @var{dim})}
% then an empty matrix is returned.
% @end deftypefn