diff scripts/image/hsv.m @ 14279:f205d0074687

Update colormap files with faster code. * autumn.m, bone.m, cool.m, copper.m, flag.m, gmap40.m, gray.m, hot.m, hsv.m, jet.m, lines.m, ocean.m, pink.m, prism.m, rainbow.m, spring.m, summer.m, white.m, winter.m: Use indexing in place of kron or repmat for faster code.
author Rik <octave@nomad.inbox5.com>
date Sat, 28 Jan 2012 22:33:57 -0800
parents 11949c9795a0
children b9c02ee24de1
line wrap: on
line diff
--- a/scripts/image/hsv.m	Sun Jan 29 00:52:19 2012 -0500
+++ b/scripts/image/hsv.m	Sat Jan 28 22:33:57 2012 -0800
@@ -20,9 +20,9 @@
 ## @deftypefn {Function File} {} hsv (@var{n})
 ## Create color colormap.  This colormap begins with red, changes through
 ## yellow, green, cyan, blue, and magenta, before returning to red.
-## It is useful for displaying periodic functions.  It is obtained by linearly
-## varying the hue through all possible values while keeping constant maximum
-## saturation and value and is equivalent to
+## It is useful for displaying periodic functions.  The map is obtained by
+## linearly varying the hue through all possible values while keeping constant
+## maximum saturation and value.  The equivalent code is
 ## @code{hsv2rgb ([linspace(0,1,N)', ones(N,2)])}.
 ##
 ## The argument @var{n} must be a scalar.
@@ -47,8 +47,8 @@
   if (n == 1)
     map = [1, 0, 0];
   elseif (n > 1)
-    h = linspace (0, 1, n)';
-    map = hsv2rgb ([h, ones(n, 1), ones(n, 1)]);
+    hue = linspace (0, 1, n)';
+    map = hsv2rgb ([hue, ones(n,1), ones(n,1)]);
   else
     map = [];
   endif