Page 235 -
P. 235

8




                             Matrices










                             8.1  Setting up Matrices
                             DEFINITION A matrix is a collection of numbers arranged in a two-dimen-
                             sional (2-D) array structure. Each element of the matrix, call it M , occupies
                                                                                      i,j
                                th
                                          th
                             the i row and j column.
                                                  M 11  M 12   M 13  L    M 1 n  
                                                  M     M      M     L    M   
                                             M =    21    22     23         2 n           (8.1)
                                                  M      M      M    O     M  
                                                                              
                                                  M m1  M m2   M m3  L    M mn 


                             We say that M is an (m ⊗ n) matrix, which means that it has m rows and n
                             columns. If m = n, we call the matrix square. If m = 1, the matrix is a row vec-
                             tor; and if n = 1, the matrix is a column vector.


                             8.1.1  Creating Matrices in MATLAB
                             8.1.1.1  Entering the Elements
                             In this method, the different elements of the matrix are keyed in; for example:


                                M=[1 3 5 7 11; 13 17 19 23 29; 31 37 41 47 53]
                             gives


                                M =
                                      1    3   5   7  11
                                     13  17   19  23   29
                                     31  37   41  47   53



                             0-8493-????-?/00/$0.00+$.50
                             © 2000 by CRC Press LLC
                            © 2001 by CRC Press LLC
   230   231   232   233   234   235   236   237   238   239   240