Page 21 - Numerical Analysis Using MATLAB and Excel
P. 21

Chapter 1  Introduction to MATLAB

                                                                3
                                                                       2
                                                         5
                                          dp dx⁄  =  12x –  32x +   4x +   8x +  10
                                            5

               1.5  Rational Polynomials

               Rational Polynomials are those which can be expressed in ratio form, that is, as

                                                   n
                                                                1
                                                                            2
                                                             n –
                                                                          n –
                                                            x
                                                                              +
                                                                                      b x +
                                                                                            b
                                                b x +
                                                                                … +
                                                                        x
                                                                    b
                                                                 +
                                                       b
                                                                       2
                                                           1
                                                 n
                                                         n –
                         Rx() =   Num x()      -------------------------------------------------------------------------------------------------------------------------  (1.8)
                                                                                             0
                                                                     n –
                                  --------------------- =
                                                                                       1
                                  Den x()      a x +   a m –  1 x m –  1  +  a m –  2 x m –  2  +  … +  a x +  a 0
                                                   m
                                                m
                                                                                        1
               where some of the terms in the numerator and/or denominator may be zero. We can find the roots
               of the numerator and denominator with the roots(p) function as before.
               Example 1.9
               Let
                                                          5
                                                                4
                                                                       2
                                              p num      x –  3x +  5x +   7x +  9
                                    Rx() =    ------------ =  -----------------------------------------------------------------------  (1.9)
                                              p den    2x –  8x +  4x +   10x +  12
                                                                      2
                                                               4
                                                          6
               Express the numerator and denominator in factored form, using the roots(p) function.
               Solution:
               num=[1  −3  0  5  7  9]; den=[2  0  −8  0  4  10  12];% Do not display num and den coefficients
               roots_num=roots(num), roots_den=roots(den)       % Display num and den roots
               roots_num =
                  2.4186 + 1.0712i    2.4186 - 1.0712i  -1.1633
                 -0.3370 + 0.9961i   -0.3370 - 0.9961i
               roots_den =
                  1.6760 + 0.4922i     1.6760 - 0.4922i  -1.9304
                 -0.2108 + 0.9870i    -0.2108 - 0.9870i  -1.0000
               As expected, the complex roots occur in complex conjugate pairs.
               For the numerator, we have the factored form
                            p num   (  x 2.4186 j1.0712 ⋅ =  –  –  )  (  x 2.4186 +  j1.0712 ⋅  )  (  x +  1.1633 ⋅  )
                                                             –
                                                          )
                                    (  x +  0.3370 j0.9961 ⋅  (  x +  0.3370 +  j0.9961 )
                                                 –
               and for the denominator, we have
                            p den   (  x 1.6760 –  j0.4922 ⋅ =  )  (  x 1.6760 +  j0.4922 ⋅  )  (  x +  1.9304 ⋅  )
                                      –
                                                             –
                                    (  x +  0.2108 j0.9870 ⋅  –  )  (  x +  0.2108 +  j0.9870 ⋅  )  (  x +  1.0000 )
               1−8                              Numerical Analysis Using MATLAB® and Excel®, Third Edition
                                                                             Copyright © Orchard Publications
   16   17   18   19   20   21   22   23   24   25   26