作用:
创建二维、三维矩阵
格式:
[X,Y] = meshgrid(x,y)
[X,Y] = meshgrid(x)
[X,Y,Z] = meshgrid(x,y,z)
[X,Y,Z] = meshgrid(x)
eg:
>> [x,y]=meshgrid(1:1:3,5:1:6)
x =
1 2 3
1 2 3
y =
5 5 5
6 6 6
> [x,y]=meshgrid(1:1:2) x = 1 2 1 2 y = 1 1 2 2
[x,y,z]=meshgrid(1:1:2) x(:,:,1) = 1 2 1 2 x(:,:,2) = 1 2 1 2 y(:,:,1) = 1 1 2 2 y(:,:,2) = 1 1 2 2 z(:,:,1) = 1 1 1 1 z(:,:,2) = 2 2 2 2