Page 100 - MATLAB an introduction with applications
P. 100

MATLAB Basics ——— 85


                    PROBLEMS

                   P1.1: Compute the following quantity using MATLAB in the Command Window:

                                                  3
                                           7
                                17        5 –1        5log (e )  4
                                               10
                                   2   2   +  π 121  + ln(e ) + 11
                                    15 –13
                   P1.2: Compute the following quantity using MATLAB in the Command Window:
                                     tan x + sin 2x
                                                      5
                                                          2
                                  B =           + log x − x + cosh x −  2tanh x ;   for  x  = 5π/6.
                                         cos x
                   P1.3: Compute the following quantity using MATLAB in the Command Window:
                                     ab  (a    ) b  a  14 b          log c
                              x =  a            c          ln(2)       10       2sinh a   3tanh b
                                                                         b
                                      c  | ab  |     e 3c        log (a      ) c
                                                                   10
                                for  a = 1, b = 2 and c = 1.8.
                   P1.4: Use MATLAB to create
                                                                        7.8
                        (a) a row and column vectors that has the elements: 11, –3, e , ln(59), tan(p/3), 5 log (26).
                                                                                           10
                        (b) a row vector with 20 equally spaced elements in which the first element is 5.
                        (c) a column vector with 15 equally spaced elements in which the first element is –1.
                   P1.5: Enter the following matrix A in MATLAB and create:

                                    1    2  3  4   5   6   7   8

                                        9  10 1112 1314 1516
                               A	      17 18 19 20 21 22 23 24

                                     25 26 27 28 29 30 31 32

                                       33 34 35 36 37 38 39 40
                                                                         st
                                                           th
                                                                            nd
                                                                                     th
                                                                               th
                                                   rd
                                                st
                        (a) a 4 × 5 matrix B from the 1 , 3  and the 5  rows, and the 1 , 2 , 4  and 8  columns of the matrix A.
                                                                    th
                                                                                th
                                                                                     th
                        (b) a 16 element-row vector C from the elements of the 5  row, and the 4  and 6  columns of the matrix A.
                                                        1.8

                   P1.6: Given the function  y 	   x  20.02    e x    ln x. Determine the value of y for the following values of
                   x : 2, 3, 8, 10, –1, –3, –5, –6.2. Solve the problem using MATLAB by first creating a vector x, and creating
                   a vector y, using element-by-element calculations.
                   P1.7:  Define a and  b as scalars,  a = 0.75, and  b = 11.3, and x,  y and  z as the vectors, x = 2, 5, 1, 9,
                   y = 0.2, 1.1, 1.8, 2 and z = –3, 2, 5, 4. Use these variables to calculate A given below using element-by-element
                   computations for the vectors with MATLAB.








                   F:\Final Book\Sanjay\IIIrd Printout\Dt. 10-03-09
   95   96   97   98   99   100   101   102   103   104   105