Programming Previous page   Next Page

Returning a Triangular Portion of a Matrix

The tril and triu functions return a triangular portion of a matrix, the former returning the piece from the lower left and the latter from the upper right. By default, the main diagonal of the matrix divides these two segments. You can use an alternate diagonal by specifying an offset from the main diagonal as a second input argument:

Concatenating Matrices Diagonally

You can diagonally concatenate matrices to form a composite matrix using the blkdiag function. See Creating a Block Diagonal Matrix for more information on how this works.

Previous page  Operating on Diagonal Matrices Empty Matrices, Scalars, and Vectors Next page

© 1994-2005 The MathWorks, Inc.