Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

meshgrid

MATLAB meshgrid functions


Description

Generate X and Y matrices for three-dimensional plots.

Usage

meshgrid(x, y, z, nargout=2)

Arguments

x, y, z

numeric vectors of values

nargout

numeric scalar that determines number of dimensions to return

Details

In the first example below, the domain specified by vectors x and y are transformed into two arrays which can be used to evaluate functions of two variables and three-dimensional surface plots. The rows of the output array x are copies of the vector x; columns of the output array y are copies of the vector y.

The second example below is syntactic sugar for specifying meshgrid(x, x).

The third example below produces three-dimensional arrays used to evaluate functions of three variables and three-dimensional volumetric plots.

Value

Returns list containing eiher two or three matrices depending on the value of nargout.

x, y, z

output matrices

Note

Limited to two- or three-dimensional Cartesian space.

Author(s)

Examples

meshgrid(1:3, 10:14)            # example 1
meshgrid(1:3)                   # example 2
meshgrid(5:8, 10:14, 2:3, 3)    # example 3

matlab

MATLAB emulation package

v1.0.2
Artistic-2.0
Authors
P. Roebuck
Initial release
2014-06-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.