diff scripts/plot/sombrero.m @ 2710:a52bd8a035a2

[project @ 1997-02-21 19:39:52 by jwe]
author jwe
date Fri, 21 Feb 1997 19:40:01 +0000
parents 5bcee07be597
children 8b262e771614
line wrap: on
line diff
--- a/scripts/plot/sombrero.m
+++ b/scripts/plot/sombrero.m
@@ -32,11 +32,15 @@
     usage ("sombrero (n)");
   endif
 
-  x = y = linspace (-8, 8, n)';
-  [xx, yy] = meshdom (x, y);
-  r = sqrt (xx .^ 2 + yy .^ 2) + eps;
-  z = sin (r) ./ r;
+  if (n > 1)
+    x = y = linspace (-8, 8, n)';
+    [xx, yy] = meshgrid (x, y);
+    r = sqrt (xx .^ 2 + yy .^ 2) + eps;
+    z = sin (r) ./ r;
 
-  mesh (x, y, z);
+    mesh (x, y, z);
+  else
+    error ("sombrero: number of grid lines must be greater than 1");
+  endif
 
 endfunction