Skip to content

meshgrid

plot · scripts/plot/util/meshgrid.m

: [X, Y] = meshgrid (x, y)
: [X, Y, Z] = meshgrid (x, y, z)
: [X, Y] = meshgrid (x)
: [X, Y, Z] = meshgrid (x)

Cartesian coordinate arrays for a 2-D rectangular or 3-D box grid.

With ny = numel (y) and nx = numel (x), X and Y are ny-by-nx with X(i,j) = x(j) and Y(i,j) = y(i). The three-argument form (or one argument with three outputs) adds nz = numel (z) and Z(i,j,k) = z(k). A single vector argument is reused for every axis. Output classes follow the inputs.