Convenient matrix building functions are
For example, zeros( produces an m,n)m × n
matrix of zeros and zeros( produces an n)n × n
one; if A is a matrix, then zeros( produces a
matrix of zeros of the same size as A)A.
If x down the diagonal; if A is a square matrix:A = 1 2 3 4 5 6 7 8 9then diag( is a vector consisting of the diagonal of A)A.
What is diag(diag(? Try it.
A))
Matrices can be built from blocks. For example, if B = [A, zeros(3,2); ones(2,3), eye(2)]will build a certain 5-by-5 matrix. Try it! |