MATLAB Function Reference
  Go to function:
    Search    Help Desk 
ndgrid    Examples   See Also

Generate arrays for multidimensional functions and interpolation

Syntax

Description

[X1,X2,X3,...] = ndgrid(x1,x2,x3,...) transforms the domain specified by vectors x1,x2,x3... into arrays X1,X2,X3... that can be used for the evaluation of functions of multiple variables and multidimensional interpolation. The ith dimension of the output array Xi are copies of elements of the vector xi.

[X1,X2,...] = ndgrid(x) is the same as [X1,X2,...] = ndgrid(x,x,...).

Examples

Evaluate the function over the range ; .

Remarks

The ndgrid function is like meshgrid except that the order of the first two input arguments are switched. That is, the statement

produces the same result as

Because of this, ndgrid is better suited to multidimensional problems that aren't spatially based, while meshgrid is better suited to problems in two- or three-dimensional Cartesian space.

See Also

meshgrid, interpn



[ Previous | Help Desk | Next ]