usage is [x Y]=meshgrid (A, b);
Meshgrid
Where A and B are all one-dimensional arrays
Give some examples
1. A=[1 2 3] b=[2 3 4]
Then the resulting matrix X and y are all 3*3 matrices.
where each row of the x matrix is [1 2 3], the number of rows is determined by the length of the array b
Each column of the Y-matrix is [2 3 4], and the number of columns is determined by the length of the array a
>> [x Y]=meshgrid (A, B)
x =
1 2 3
1 2 3
1 2 3
y =
2 2 2
3 3 3
4 4 4
2.a=[1 2 3] b=[2 3]
The resulting x and y are all 3*2 matrices.
>> [x Y]=meshgrid (A, B)
x =
1 2 3
1 2 3
y =
2 2 2
3 3 3
where each row of the x matrix is [1 2 3], the number of rows is determined by the length of the array b
Each column of the y Matrix is [2 3], and the number of columns is determined by the length of the array A.
3.a=[1 2] b= [2 3 4]
The resulting matrices are all 2*3 dimensions.
>> [x Y]=meshgrid (A, B)
x =
1 2
1 2
1 2
y =
2 2
3 3
4 4
where each row of the x matrix is 1 2, the number of rows is determined by the length of the array B.
Each column of the Y-matrix is 2 3 4, and the number of columns is determined by the length of the array a