comparison scripts/plot/meshgrid.m @ 3803:63c75bc3db82

[project @ 2001-02-28 08:24:40 by jwe]
author jwe
date Wed, 28 Feb 2001 08:24:43 +0000
parents c73bea82af94
children 22bd65326ec1
comparison
equal deleted inserted replaced
3802:4f1a26a730fd 3803:63c75bc3db82
34 if (nargin == 1) 34 if (nargin == 1)
35 y = x; 35 y = x;
36 endif 36 endif
37 if (nargin > 0 && nargin < 3) 37 if (nargin > 0 && nargin < 3)
38 if (is_vector (x) && is_vector (y)) 38 if (is_vector (x) && is_vector (y))
39 xlen = length (x); 39 xx = ones (length (y), 1) * x(:).';
40 ylen = length (y); 40 yy = y(:) * ones (1, length (x));
41 xx = zeros (ylen, xlen);
42 yy = zeros (ylen, xlen);
43 if (columns (x) == 1)
44 x = x.';
45 endif
46 if (rows (y) == 1)
47 y = y.';
48 endif
49 for i = 1:ylen
50 xx(i,:) = x;
51 endfor
52 for i = 1:xlen
53 yy(:,i) = y;
54 endfor
55 else 41 else
56 error ("meshgrid: arguments must be vectors"); 42 error ("meshgrid: arguments must be vectors");
57 endif 43 endif
58 else 44 else
59 usage ("[xx, yy] = meshgrid (x, y)"); 45 usage ("[xx, yy] = meshgrid (x, y)");