meshgrid
Generate grid from vectors.
- [X,Y] = meshgrid(x,y) generates from vectors x and y a full grid X, Y
- meshgrid(x) is equivalent to meshgrid(x,x)
Examples
>> [X, Y] = meshgrid(-8:0.8:8) Z = sin(sqrt(X.^2 + Y.^2)) ./ sqrt(X.^2 + Y.^2) surf(X, Y, Z, struct('lineWidth', 0.1)) [X:21x21 double] [Y:21x21 double] [Z:21x21 double] [ans:1x1 struct]
>> [X, Y] = meshgrid(-5:5) Z = atan2(Y,X) surf(X, Y, Z, struct('lineWidth', 0.1, 'pitch', 0.7, 'yaw', 0.8)) [X:11x11 double] [Y:11x11 double] [Z:11x11 double] [ans:1x1 struct]