Mercurial > octave-nkf
diff scripts/plot/mesh.m @ 4:b4df021f796c
[project @ 1993-08-08 01:26:08 by jwe]
Initial revision
author | jwe |
---|---|
date | Sun, 08 Aug 1993 01:26:08 +0000 |
parents | |
children | 16a24e76d6e0 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/scripts/plot/mesh.m Sun Aug 08 01:26:08 1993 +0000 @@ -0,0 +1,56 @@ +function mesh (x, y, z) + +# usage: mesh (x, y, z) +# +# See also: plot, semilogx, semilogy, loglog, polar, meshdom, contour, +# bar, stairs, gplot, gsplot, replot, xlabel, ylabel, title + + if (nargin == 1) + z = x; + if (is_matrix (z)) + set hidden3d; + set data style lines; + set surface; + set nocontour; + set noparametric; + set view 60, 30, 1, 1 + gsplot (z); + else + error ("mesh: argument must be a matrix"); + endif + elseif (nargin == 3) + if (is_vector (x) && is_vector (y) && is_matrix (z)) + xlen = length (x); + ylen = length (y); + if (xlen == rows (z) && ylen == columns (z)) + if (rows (x) == 1) + x = x'; + endif + len = 3 * ylen; + zz = zeros (xlen, ylen); + k = 1; + for i = 1:3:len + zz(:,i) = x; + zz(:,i+1) = y(k) * ones (xlen, 1); + zz(:,i+2) = z(:,k); + k++; + endfor + set hidden3d; + set data style lines; + set surface; + set nocontour; + set parametric; + set view 60, 30, 1, 1 + gsplot (zz); + else + disp ("mesh: rows (z) must be the same as length (x)"); + error (" and columns (z) must be the same as length (y)"); + endif + else + error ("mesh: x and y must be vectors and z must be a matrix"); + endif + else + error ("usage: mesh (z)"); + endif + +endfunction