Function Reference
— Function File: [y1, y2, ..., yn] = ndgrid (x1, x2, ..., xn)
— Function File: [y1, y2, ..., yn] = ndgrid (x)

Given n vectors x1, ... xn, ndgrid returns n arrays of dimension n. The elements of the ith output argument contains the elements of the vector xi repeated over all dimensions different from the ith dimension. Calling ndgrid with only one input argument x is equivalent of calling ndgrid with all n input arguments equal to x:

[y1, y2, ..., yn] = ndgrid (x, ..., x)

See also: meshgrid