changeset 17508:9b2443f97a3e

Merge the official development
author LYH <lyh.kernel@gmail.com>
date Thu, 26 Sep 2013 04:47:20 +0800
parents e8d3d5a5a867 (current diff) 89ffc9c786e5 (diff)
children 5f884a545c06
files
diffstat 2 files changed, 11 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/meshgrid.m
+++ b/scripts/plot/meshgrid.m
@@ -46,9 +46,9 @@
 ## Programming Note: @code{meshgrid} is restricted to 2-D or 3-D grid
 ## generation.  The @code{ndgrid} function will generate 1-D through N-D
 ## grids.  However, the functions are not completely equivalent.  If @var{x}
-## is a vector of length M and @var{y} is a vector of length N, then @code
-## meshgrid will produce an output grid which is NxM.  @code{ndgrid} will
-## produce an output which is MxN for the same input.
+## is a vector of length M and @var{y} is a vector of length N, then
+## @code{meshgrid} will produce an output grid which is NxM.  @code{ndgrid}
+## will produce an output which is MxN for the same input.
 ## @seealso{ndgrid, mesh, contour, surf}
 ## @end deftypefn
 
--- 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