The functions `newhat' and `hat' do not quite follow the format for the augmented matrix described on page 19, because the entry in the lower right corner is not 0, but, rather, the number m of rows of A. In using row and column operations to transform the upper left mxn corner of the augmented matrix into diagonal form, you never change this entry. Therefore, when the transformation is complete and you are ready to use `unhat' to break the augmented matrix into its three parts D, M, and N, the number m is still in the lower right corner where Matlab can find it.
The function `unhat' has one input, the (m + n)x(m + n) augmented matrix, and three outputs, the matrix in the upper left mxn corner, call it D, the matrix in the upper right mxm corner, call it M, and the matrix in the lower right nxn corner, call it N. The value of m is taken from the lower right corner of the input matrix and is used to find n (the number of rows in the input matrix minus m) and hence to find the three output matrices.
The standard form for a command that uses a function with more than one output is to give names for each output on the left side of the = sign, enclosed in square brackets. Thus, the command [D,M,N] = unhat(G) means `apply the function unhat to the matrix G and give the three outputs the names D, M, N, in that order'. If you are only interested in D, as will happen in some of the examples you do, you can just give the command D = unhat(G). The first output will be given the name D and the other two outputs will be ignored.
Return to Chapter 2.