Learn R Programming

pracma (version 1.8.8)

meshgrid: Generate a Mesh Grid

Description

Generate two matrices for use in three-dimensional plots.

Usage

meshgrid(x, y = x)

Arguments

x
numerical vector, represents points along the x-axis.
y
numerical vector, represents points along the y-axis.

Value

  • Returns two matrices as a list with X and Y components.

Details

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.

See Also

outer

Examples

Run this code
meshgrid(1:5)$X
meshgrid(c(1, 2, 3), c(11, 12))

Run the code above in your browser using DataLab