Special matrices

Besides by direct input, some special matrices can also be formed directly with MATLAB commands. These matrices are: If you want to give a matrix the same size as a given matrix $ A$ , then you can do this by using the command size. For example, the command

>> zeros(size(A))

forms a zero matrix with the same size as the matrix $ A$ . Of the above commands, only the command diag accepts a matrix as its argument. The result of the command diag(A), where $ A$ is a matrix, is a column vector consisting of the diagonal elements of $ A$ .

Previous      Next      Up      Contents

Esteur 2010-03-22