changeset 17507:89ffc9c786e5

sombrero.m: Return meshgridded x,y rather than vectors. * scripts/plot/sombrero.m: Return meshgridded x,y rather than vectors so that behavior is the same as peaks().
author Rik <rik@octave.org>
date Wed, 25 Sep 2013 13:46:09 -0700
parents ff5ff67946cb
children 9b2443f97a3e cd98a50bfa63
files scripts/plot/sombrero.m
diffstat 1 files changed, 8 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/sombrero.m
+++ b/scripts/plot/sombrero.m
@@ -57,20 +57,18 @@
     error ("sombrero: number of grid lines N must be greater than 1");
   endif
 
-  tx = linspace (-8, 8, n)';
-  ty = tx;
-  [xx, yy] = meshgrid (tx, ty);
-  r = sqrt (xx .^ 2 + yy .^ 2) + eps;  # eps prevents div/0 errors
-  tz = sin (r) ./ r;
+  [xx, yy] = meshgrid (linspace (-8, 8, n));
+  r = sqrt (xx.^2 + yy.^2) + eps;  # eps prevents div/0 errors
+  zz = sin (r) ./ r;
 
   if (nargout == 0)
-    surf (tx, ty, tz);
+    surf (xx, yy, zz);
   elseif (nargout == 1)
-    x = tz;
+    x = zz;
   else
-    x = tx;
-    y = ty;
-    z = tz;
+    x = xx;
+    y = yy;
+    z = zz;
   endif
 
 endfunction