Page 24 - Basics of MATLAB and Beyond
P. 24

>>a+b
                               ans  =
                                   11    33
                                   44    66
                                   77    99

                               3.8   Transpose
                               To convert rows into columns use the transpose symbol ’:

                               >> a’
                               ans  =

                                    1     4      7
                                    3     6      9

                               >> b = [[1 2 3]’ [4 5 6]’]
                               b  =
                                    1     4
                                    2     5
                                    3     6
                               Be careful when taking the transpose of complex matrices. The transpose
                               operator takes the complex conjugate transpose. If z is the matrix:

                                                         1      0 − i
                                                         0+2i 1+ i
                               then z’ is:

                                                        1     0 − 2i
                                                                      .
                                                        0+ i 1 − i
                               To take the transpose without conjugating the complex elements, use
                               the .’ operator. In this case z.’ is:

                                                        1     0+2i    .
                                                        0 − i 1+ i

                               4    Basic Graphics


                               The bread-and-butter of matlab graphics is the plot command. Earlier
                               we produced a plot of the sine function:

                               x = 0:.1:2*pi;
                               y = sin(x);
                               plot(x,y)




                               c   2000 by CRC Press LLC
   19   20   21   22   23   24   25   26   27   28   29