Mercurial > hg > octave-nkf
changeset 2710:a52bd8a035a2
[project @ 1997-02-21 19:39:52 by jwe]
author | jwe |
---|---|
date | Fri, 21 Feb 1997 19:40:01 +0000 |
parents | 0f72b0462b51 |
children | b50865d6de09 |
files | scripts/plot/meshdom.m scripts/plot/meshgrid.m scripts/plot/sombrero.m |
diffstat | 3 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/meshdom.m +++ b/scripts/plot/meshdom.m @@ -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
--- a/scripts/plot/meshgrid.m +++ b/scripts/plot/meshgrid.m @@ -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
--- 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