Mercurial > hg > octave-nkf
annotate scripts/statistics/base/range.m @ 10793:be55736a0783
Grammarcheck the documentation from m-files.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 18 Jul 2010 20:35:16 -0700 |
parents | 5fb7e17281e8 |
children | e151e23f73bc |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 1995, 1996, 1997, 1998, 2000, 2002, 2004, 2005, 2006, |
2 ## 2007 Kurt Hornik | |
9160 | 3 ## Copyright (C) 2009 Jaroslav Hajek |
3426 | 4 ## |
3922 | 5 ## This file is part of Octave. |
6 ## | |
7 ## Octave is free software; you can redistribute it and/or modify it | |
8 ## under the terms of the GNU General Public License as published by | |
7016 | 9 ## the Free Software Foundation; either version 3 of the License, or (at |
10 ## your option) any later version. | |
3426 | 11 ## |
3922 | 12 ## Octave is distributed in the hope that it will be useful, but |
3200 | 13 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
14 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
3426 | 15 ## General Public License for more details. |
16 ## | |
3200 | 17 ## You should have received a copy of the GNU General Public License |
7016 | 18 ## along with Octave; see the file COPYING. If not, see |
19 ## <http://www.gnu.org/licenses/>. | |
3200 | 20 |
3453 | 21 ## -*- texinfo -*- |
10793
be55736a0783
Grammarcheck the documentation from m-files.
Rik <octave@nomad.inbox5.com>
parents:
9193
diff
changeset
|
22 ## @deftypefn {Function File} {} range (@var{x}) |
4848 | 23 ## @deftypefnx {Function File} {} range (@var{x}, @var{dim}) |
3453 | 24 ## If @var{x} is a vector, return the range, i.e., the difference |
25 ## between the maximum and the minimum, of the input data. | |
3200 | 26 ## |
3453 | 27 ## If @var{x} is a matrix, do the above for each column of @var{x}. |
4847 | 28 ## |
29 ## If the optional argument @var{dim} is supplied, work along dimension | |
30 ## @var{dim}. | |
3453 | 31 ## @end deftypefn |
3426 | 32 |
5428 | 33 ## Author: KH <Kurt.Hornik@wu-wien.ac.at> |
3456 | 34 ## Description: Compute range |
3200 | 35 |
9160 | 36 function y = range (x, dim) |
3426 | 37 |
9160 | 38 if (nargin == 1) |
39 y = max (x) - min (x); | |
40 elseif (nargin == 2) | |
9193
5fb7e17281e8
really fix the bug in range
Jaroslav Hajek <highegg@gmail.com>
parents:
9160
diff
changeset
|
41 y = max (x, [], dim) - min (x, [], dim); |
9160 | 42 else |
6046 | 43 print_usage (); |
3200 | 44 endif |
45 | |
46 endfunction |