Create Vectors

Vectors in MuPAD® do not form a separate data type. As matrices, vectors belong to the type Dom::Matrix(). To create a row or a column vector, use the matrix command and specify one of the dimensions to be 1. For example, create a row vector that contains five elements:

matrix(1, 5, [1, 2, 3, 4, 5])

Now, create a column vector of five elements:

matrix(5, 1, [1, 2, 3, 4, 5])

If you do not specify the dimensions, the matrix command creates a column vector:

matrix([x, y, z])

Was this topic helpful?