# HG changeset patch # User jwe # Date 856554001 0 # Node ID a52bd8a035a279c1c8c0f8bfbedaa5c8ae27ed31 # Parent 0f72b0462b51a769879dda61206a96caa0a2aedc [project @ 1997-02-21 19:39:52 by jwe] diff -r 0f72b0462b51 -r a52bd8a035a2 scripts/plot/meshdom.m --- a/scripts/plot/meshdom.m Thu Feb 20 17:55:44 1997 +0000 +++ b/scripts/plot/meshdom.m Fri Feb 21 19:40:01 1997 +0000 @@ -19,13 +19,8 @@ ## usage: [xx, yy] = meshdom (x, y) ## -## Given vectors of x and y coordinates, return two matrices -## corresponding to the x and y coordinates of the mesh. -## -## See the file sombrero.m for an example of using mesh and meshdom. -## -## See also: plot, semilogx, semilogy, loglog, polar, mesh, contour, -## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title +## Note: this function is provided for compatibility with older versions +## of Matlab. You should use meshgrid() instead. ## Author: jwe diff -r 0f72b0462b51 -r a52bd8a035a2 scripts/plot/meshgrid.m --- a/scripts/plot/meshgrid.m Thu Feb 20 17:55:44 1997 +0000 +++ b/scripts/plot/meshgrid.m Fri Feb 21 19:40:01 1997 +0000 @@ -25,6 +25,8 @@ ## ## [xx, yy] = meshgrid (x) is an abbreviation for [xx, yy] = meshgrid (x, x). ## +## See sombrero.m for an example of using meshgrid. +## ## See also: plot, semilogx, semilogy, loglog, polar, mesh, meshdom, contour, ## bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title diff -r 0f72b0462b51 -r a52bd8a035a2 scripts/plot/sombrero.m --- a/scripts/plot/sombrero.m Thu Feb 20 17:55:44 1997 +0000 +++ b/scripts/plot/sombrero.m Fri Feb 21 19:40:01 1997 +0000 @@ -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