meshgrid: Rectangular 2-D Grid

Description Usage Arguments Value See Also Examples

Description

Creates matrices for vectorized evaluations of 2-D scalar/vector fields over 2-D grids.

Usage

1
meshgrid(x, y = x)

Arguments

x

Numeric vector representing the first coordinate of the grid.

y

Numeric vector representing the second coordinate of the grid.

Value

A list of matrices.

See Also

expand.grid, outer.

Examples

1
2
3
4
mg <- meshgrid(linspace(-4*pi, 4*pi, 27))  # list of input matrices
z <- cos(mg[[1]]^2 + mg[[2]]^2) * exp(-sqrt(mg[[1]]^2 + mg[[2]]^2)/6)
image(z, axes = FALSE)  # color image
contour(z, add = TRUE, drawlabels = FALSE)  # add contour lines

bgreenwell/ramify documentation built on May 12, 2019, 8:20 p.m.