Mercurial > octave-nkf
comparison scripts/plot/mesh.m @ 5214:eecc24b92d97
[project @ 2005-03-16 17:14:12 by jwe]
author | jwe |
---|---|
date | Wed, 16 Mar 2005 17:14:12 +0000 |
parents | c08cb1098afc |
children | 32c569794216 |
comparison
equal
deleted
inserted
replaced
5213:390f13fc0f4a | 5214:eecc24b92d97 |
---|---|
26 ## correspond to different @var{x} values and rows of @var{z} correspond | 26 ## correspond to different @var{x} values and rows of @var{z} correspond |
27 ## to different @var{y} values. | 27 ## to different @var{y} values. |
28 ## @end deftypefn | 28 ## @end deftypefn |
29 ## | 29 ## |
30 ## @seealso{plot, semilogx, semilogy, loglog, polar, meshgrid, meshdom, | 30 ## @seealso{plot, semilogx, semilogy, loglog, polar, meshgrid, meshdom, |
31 ## contour, bar, stairs, gplot, gsplot, replot, xlabel, ylabel, and title} | 31 ## contour, bar, stairs, replot, xlabel, ylabel, and title} |
32 | 32 |
33 ## Author: jwe | 33 ## Author: jwe |
34 | 34 |
35 function mesh (x, y, z) | 35 function mesh (x, y, z) |
36 | 36 |
39 ## no way to determine their current values. | 39 ## no way to determine their current values. |
40 | 40 |
41 if (nargin == 1) | 41 if (nargin == 1) |
42 z = x; | 42 z = x; |
43 if (ismatrix (z)) | 43 if (ismatrix (z)) |
44 gset hidden3d; | 44 __gset__ hidden3d; |
45 gset data style lines; | 45 __gset__ data style lines; |
46 gset surface; | 46 __gset__ surface; |
47 gset nocontour; | 47 __gset__ nocontour; |
48 gset noparametric; | 48 __gset__ noparametric; |
49 gset nologscale; | 49 __gset__ nologscale; |
50 gset view 60, 30, 1, 1 | 50 __gset__ view 60, 30, 1, 1 |
51 gsplot (z'); | 51 __gsplot__ (z'); |
52 else | 52 else |
53 error ("mesh: argument must be a matrix"); | 53 error ("mesh: argument must be a matrix"); |
54 endif | 54 endif |
55 elseif (nargin == 3) | 55 elseif (nargin == 3) |
56 if (isvector (x) && isvector (y) && ismatrix (z)) | 56 if (isvector (x) && isvector (y) && ismatrix (z)) |
67 zz(:,i) = x(k) * ones (ylen, 1); | 67 zz(:,i) = x(k) * ones (ylen, 1); |
68 zz(:,i+1) = y; | 68 zz(:,i+1) = y; |
69 zz(:,i+2) = z(:,k); | 69 zz(:,i+2) = z(:,k); |
70 k++; | 70 k++; |
71 endfor | 71 endfor |
72 gset hidden3d; | 72 __gset__ hidden3d; |
73 gset data style lines; | 73 __gset__ data style lines; |
74 gset surface; | 74 __gset__ surface; |
75 gset nocontour; | 75 __gset__ nocontour; |
76 gset nologscale; | 76 __gset__ nologscale; |
77 gset parametric; | 77 __gset__ parametric; |
78 gset view 60, 30, 1, 1 | 78 __gset__ view 60, 30, 1, 1 |
79 gsplot (zz); | 79 __gsplot__ (zz); |
80 gset noparametric; | 80 __gset__ noparametric; |
81 else | 81 else |
82 msg = "mesh: rows (z) must be the same as length (y) and"; | 82 msg = "mesh: rows (z) must be the same as length (y) and"; |
83 msg = sprintf ("%s\ncolumns (z) must be the same as length (x)", msg); | 83 msg = sprintf ("%s\ncolumns (z) must be the same as length (x)", msg); |
84 error (msg); | 84 error (msg); |
85 endif | 85 endif |
95 zz(:,i) = x(:,k); | 95 zz(:,i) = x(:,k); |
96 zz(:,i+1) = y(:,k); | 96 zz(:,i+1) = y(:,k); |
97 zz(:,i+2) = z(:,k); | 97 zz(:,i+2) = z(:,k); |
98 k++; | 98 k++; |
99 endfor | 99 endfor |
100 gset hidden3d; | 100 __gset__ hidden3d; |
101 gset data style lines; | 101 __gset__ data style lines; |
102 gset surface; | 102 __gset__ surface; |
103 gset nocontour; | 103 __gset__ nocontour; |
104 gset nologscale; | 104 __gset__ nologscale; |
105 gset parametric; | 105 __gset__ parametric; |
106 gset view 60, 30, 1, 1 | 106 __gset__ view 60, 30, 1, 1 |
107 gsplot (zz); | 107 __gsplot__ (zz); |
108 gset noparametric; | 108 __gset__ noparametric; |
109 else | 109 else |
110 error ("mesh: x, y, and z must have same dimensions"); | 110 error ("mesh: x, y, and z must have same dimensions"); |
111 endif | 111 endif |
112 else | 112 else |
113 error ("mesh: x and y must be vectors and z must be a matrix"); | 113 error ("mesh: x and y must be vectors and z must be a matrix"); |