To make a new matrix from scratch use creatematrix.

make a new matrix filled with 1's

Use "1" as the direct parameter.
set m to creatematrix "1" ncols 20 nrows 15 as matrix
This returns a matrix with 300 values equal to 1.0.

make a new matrix filled with the x index

Use "x" as the direct parameter.
set m to creatematrix "x" ncols 20 nrows 15 as matrix
This returns a matrix with 15 identical rows, each row contains {0.0, 1.0, ..., 19.0}.

make a new matrix filled with the y index

Use "y" as the direct parameter.
set m to creatematrix "y" ncols 20 nrows 15 as matrix
This returns a matrix with 20 identical columns, each column contains {0.0, 1.0, ..., 14.0}.

make a new matrix filled with a linear xscale or yscale

Use "x" or "y" as the direct parameter, and specify a range parameter as a list of two numbers.
set m to creatematrix "y" ncols 20 nrows 15 as matrix range {0, 28}
This returns a matrix with 20 identical columns, each column contains {0.0, 2.0, ..., 28.0}.

make a new matrix with an arbitrary xscale or yscale

Use "x" or "y" as the direct parameter, and specify an array of real as the ncols (or nrows) parameter.
set a to {0, 1, pi} as array of real
set m to creatematrix "x" ncols a nrows 15 as matrix
This returns a matrix with 15 identical rows and 3 columns, each row containing {0, 1, pi}.

make a new diagonal matrix

Use "d" as the direct parameter, and specify an array of real as the diagonal (or a single real number, in which case you must specify ncols).
set a to {0, 1, pi} as array of real
set m to creatematrix "d" diagonal a as matrix
This returns a diagonal 3 x 3 matrix with {0, 1, pi} as its diagonal.
set m to creatematrix "d" diagonal 1 ncols 10 as matrix
This returns the 10 x 10 Identity matrix.
