1.meshgrid usage
x = 1:3;
y = 1:5;
[XR,YR] = meshgrid(x,y)
%-------%结果
XR = 5×3
1 2 3
1 2 3
1 2 3
1 2 3
1 2 3
YR = 5×3
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
%%
XR矩阵的每一行是x的副本,
YR矩阵的每一列是y的副本。
XR和YR的维度是length(y) * length(x)
2. Application of meshgrid in graphics
Use this function to generate grid points, and evaluate the coordinates of the grid points as independent variables.