Define2DGrid

Prototype

Matrix Define2DGrid( Matrix mXMin, Matrix mXMax, Matrix mNumXPts, Matrix mYMin, Matrix mYMax, Matrix mNumYPts )

Return Value

The return value is an (mNumXPts*mNumYPts x 2) matrix, each row of which is an ordered pair in a uniform grid of points within the rectangle [mXMin, mXMax] x [mYMin, mYMax].

Parameters

Matrix mXMin
A scalar giving the minimum value of the X coordinate of the grid.

Matrix mXMax
A scalar giving the maximum value of the X coordinate of the grid.

Matrix mNumXPts
A scalar giving the number of grid lines in the X direction.

Matrix mYMin
A scalar giving the minimum value of the Y coordinate of the grid.

Matrix mYMax
A scalar giving the maximum value of the Y coordinate of the grid.

Matrix mNumYPts
A scalar giving the number of grid lines in the Y direction.

Remarks

This module is useful for visualizing functions of two variables, or for evaluating a function at a uniform grid of points.

Example
/* create a 5 x 10 grid on [-1,1] x [-2,2] */
mXYGrid = Define2DGrid( -1, 1, 5, -2, 2, 10 );
mZ = mXYGrid[,1]##2 + mXYGrid[,2]##2;
declare RotatingPlot plot;
plot = RotatingPlot.Create("Surface", mXYGrid[,1], mXYGrid[,2], mZ, false );
plot.SetDrawingMode( SMOOTHCOLORMESH );
plot.ShowWindow();