>> 
>> x= 1:4
x =
     1     2     3     4

>> y=5:7
y =
     5     6     7

>> [X,Y] = meshgrid(x,y)
X =
     1     2     3     4
     1     2     3     4
     1     2     3     4
Y =
     5     5     5     5
     6     6     6     6
     7     7     7     7
>> 

Note how meshgrid spreads the x vector across the rows, and spreads the y vector across each column.