FUNCTION REFERENCE
meshgrid
Create a 2-D grid with x varying across columns.
Create a 2-D grid with x varying across columns.
Syntax
[X,Y] = meshgrid(x, y)Syntax
[X,Y] = meshgrid(x)Syntax
X = meshgrid(x, y)Returns numel(y)-by-numel(x) arrays. Each row of X repeats x, and each column of Y repeats y. One input uses x for both axes. One output returns X only. Inputs are numeric or logical (complex allowed); matrix inputs are read in column order.
Example
[X,Y]=meshgrid(1:3,1:2); X % [1 2 3; 1 2 3]Example
[X,Y,Z]=meshgrid(1:3,1:2,1:4); size(X) % [2 3 4]Differences from MATLAB: A grid whose imaginary parts are all zero is real. The 3-D form [X,Y,Z] = meshgrid(x,y,z) (and meshgrid(x) with three outputs) takes real vectors only.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.