Page 238 -
P. 238

P=eye(4,4)

                             gives

                                P =
                                     1000
                                     0100
                                     0010
                                     0001

                                • The matrix of size (n ⊗ n) with elements randomly chosen from
                                   the interval [0, 1], such as:

                                Q=rand(4,4)

                             gives, in one instance:

                                Q =
                                     0.9708    0.4983   0.9601    0.2679
                                     0.9901    0.2140   0.7266    0.4399
                                     0.7889    0.6435   0.4120    0.9334
                                     0.4387    0.3200   0.7446    0.6833

                                • We can select to extract the upper triangular part of the Q matrix,
                                   but assign to all the lower triangle elements the value zero:

                                upQ=triu(Q)

                             produces

                                upQ =
                                     0.9708    0.4983   0.9601    0.2679
                                     0         0.2140   0.7266    0.4399
                                     0         0        0.4120    0.9334
                                     0         0        0         0.6833

                             or extract the lower triangular part of the Q matrix, but assign to all the upper
                             triangle elements the value zero:

                                loQ=tril(Q)

                             produces

                                loQ =

                             © 2001 by CRC Press LLC
   233   234   235   236   237   238   239   240   241   242   243