Page 241 -
P. 241

gives

                                G =
                                     1111
                                     1111

                             Enter

                                H=[D;G]

                             produces

                                H =
                                     1234
                                     5678
                                     1111
                                     1111

                              Finally, the command sum applied to a matrix gives a row in which m-ele-
                             ment is the sum of all the elements of the m column in the original matrix.
                                                                    th
                             For example, entering:

                                sum(H)

                             produces


                                ans =
                                     8101214






                             8.2  Adding Matrices
                             Adding two matrices is only possible if they have equal numbers of rows and
                             equal numbers of columns; or, said differently, they both have the same size.
                              The addition operation is the obvious one. That is, the (m, n) element of the
                             sum (A+B) is the sum of the (m, n) elements of respectively A and B:

                                                     (AB+  )  = A  + B                      (8.2)
                                                           mn    mn   mn

                             Entering


                             © 2001 by CRC Press LLC
   236   237   238   239   240   241   242   243   244   245   246