changeset 16353:ca395af72d88

hsv.m: Make colormap compatible with Matlab (bug #36473). * scripts/image/hsv.m: Make colormap compatible with Matlab (bug #36473).
author Rik <rik@octave.org>
date Thu, 21 Mar 2013 07:45:04 -0700
parents b8a4f313e78e
children fb27f1e08297
files scripts/image/hsv.m
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/image/hsv.m	Thu Mar 21 07:42:59 2013 -0700
+++ b/scripts/image/hsv.m	Thu Mar 21 07:45:04 2013 -0700
@@ -23,7 +23,7 @@
 ## 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)])}.
+## @code{hsv2rgb ([(0:N-1)'/N, ones(N,2)])}.
 ##
 ## The argument @var{n} must be a scalar.
 ## If unspecified, the length of the current colormap, or 64, is used.
@@ -50,7 +50,7 @@
   if (n == 1)
     map = [1, 0, 0];
   elseif (n > 1)
-    hue = linspace (0, 1, n)';
+    hue = [0:n-1]' / n;
     map = hsv2rgb ([hue, ones(n,1), ones(n,1)]);
   else
     map = zeros (0, 3);