Mercurial > hg > octave-nkf
annotate scripts/image/summer.m @ 9168:742cf6388a8f
Update section 17.7 (Coordinate Transformations) of arith.txi
author | Rik <rdrider0-list@yahoo.com> |
---|---|
date | Sat, 02 May 2009 07:20:35 -0700 |
parents | 1bf0ce0930be |
children | 16f53d29049f |
rev | line source |
---|---|
7017 | 1 ## Copyright (C) 1999, 2000, 2007 Kai Habel |
6788 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
6788 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
6788 | 18 |
19 ## -*- texinfo -*- | |
20 ## @deftypefn {Function File} {} summer (@var{n}) | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
7017
diff
changeset
|
21 ## Create color colormap. This colormap is green to yellow. |
6788 | 22 ## The argument @var{n} should be a scalar. If it |
23 ## is omitted, the length of the current colormap or 64 is assumed. | |
24 ## @seealso{colormap} | |
25 ## @end deftypefn | |
26 | |
27 ## Author: Kai Habel <kai.habel@gmx.de> | |
28 ## Date: 06/03/2000 | |
29 function map = summer (number) | |
30 | |
31 if (nargin == 0) | |
32 number = rows (colormap); | |
33 elseif (nargin == 1) | |
6791 | 34 if (! isscalar (number)) |
6788 | 35 error ("summer: argument must be a scalar"); |
36 endif | |
37 else | |
38 print_usage (); | |
39 endif | |
40 | |
41 if (number == 1) | |
42 map = [0, 0.5, 0.4]; | |
43 elseif (number > 1) | |
44 r = (0:number - 1)' ./ (number - 1); | |
45 g = 0.5 + r ./ 2; | |
46 b = 0.4 * ones (number, 1); | |
47 | |
48 map = [r, g, b]; | |
49 else | |
50 map = []; | |
51 endif | |
52 | |
53 endfunction |