comparison scripts/image/spring.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 72c96de7a403
comparison
equal deleted inserted replaced
11586:12df7854fa7c 11587:c792872f8942
18 18
19 ## -*- texinfo -*- 19 ## -*- texinfo -*-
20 ## @deftypefn {Function File} {@var{map} =} spring () 20 ## @deftypefn {Function File} {@var{map} =} spring ()
21 ## @deftypefnx {Function File} {@var{map} =} spring (@var{n}) 21 ## @deftypefnx {Function File} {@var{map} =} spring (@var{n})
22 ## Create color colormap. This colormap varies from magenta to yellow. 22 ## Create color colormap. This colormap varies from magenta to yellow.
23 ## The argument @var{n} must be a scalar. 23 ## The argument @var{n} must be a scalar.
24 ## If unspecified, the length of the current colormap, or 64, is used. 24 ## If unspecified, the length of the current colormap, or 64, is used.
25 ## @seealso{colormap} 25 ## @seealso{colormap}
26 ## @end deftypefn 26 ## @end deftypefn
27 27
28 ## Author: Kai Habel <kai.habel@gmx.de> 28 ## Author: Kai Habel <kai.habel@gmx.de>
38 else 38 else
39 print_usage (); 39 print_usage ();
40 endif 40 endif
41 41
42 if (n == 1) 42 if (n == 1)
43 map = [1, 0, 1]; 43 map = [1, 0, 1];
44 elseif (n > 1) 44 elseif (n > 1)
45 r = ones (n, 1); 45 r = ones (n, 1);
46 g = (0:n - 1)' ./ (n - 1); 46 g = (0:n - 1)' ./ (n - 1);
47 b = 1 - g; 47 b = 1 - g;
48 map = [r, g, b]; 48 map = [r, g, b];