Mercurial > hg > octave-lyh
changeset 6076:b15a143c5607
[project @ 2006-10-24 16:09:21 by jwe]
author | jwe |
---|---|
date | Tue, 24 Oct 2006 16:09:21 +0000 |
parents | eaeff5ddfae5 |
children | 95f153281c97 |
files | scripts/plot/__plt3__.m scripts/plot/mesh.m scripts/plot/sombrero.m |
diffstat | 3 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/plot/__plt3__.m +++ b/scripts/plot/__plt3__.m @@ -38,6 +38,8 @@ if (nargin < 2) have_usingstr = false; usingstr = ""; + else + have_usingstr = true; endif if (nargin < 3) fmtstr = "";
--- a/scripts/plot/mesh.m +++ b/scripts/plot/mesh.m @@ -46,7 +46,7 @@ __gnuplot_set__ noparametric; __gnuplot_raw__ ("set nologscale;\n"); __gnuplot_raw__ ("set view 60, 30, 1, ;\n"); - __plt3__ (z'); + __plt3__ (z', ""); else error ("mesh: argument must be a matrix"); endif @@ -107,7 +107,7 @@ __gnuplot_raw__ ("set nologscale;\n"); __gnuplot_set__ parametric; __gnuplot_raw__ ("set view 60, 30, 1, 1;\n"); - __plt3__ (zz); + __plt3__ (zz, ""); unwind_protect_cleanup __gnuplot_set__ noparametric; end_unwind_protect
--- a/scripts/plot/sombrero.m +++ b/scripts/plot/sombrero.m @@ -19,13 +19,13 @@ ## -*- texinfo -*- ## @deftypefn {Function File} {} sombrero (@var{n}) -## ## Draw a `sombrero' in three dimensions using @var{n} grid lines. The ## function plotted is ## ## @example ## z = sin (sqrt (x^2 + y^2)) / (sqrt (x^2 + y^2)) ## @end example +## @seealso{mesh, meshgrid} ## @end deftypefn ## Author: jwe @@ -38,13 +38,17 @@ if (nargin < 2) if (n > 1) - x = y = linspace (-8, 8, n)'; - [xx, yy] = meshgrid (x, y); + tx = ty = linspace (-8, 8, n)'; + [xx, yy] = meshgrid (tx, ty); r = sqrt (xx .^ 2 + yy .^ 2) + eps; - z = sin (r) ./ r; + tz = sin (r) ./ r; if (nargout == 0) - mesh (x, y, z); - end + mesh (tx, ty, tz); + else + x = tx; + y = ty; + z = tz; + endif else error ("sombrero: number of grid lines must be greater than 1"); endif