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

Solutions to End−of−Chapter Exercises


                7.11 Solutions to End−of−Chapter Exercises

                1.
                                                                    3
                                                               4
                                                         5
                                                 fx() =  x –  2x + 4x – x +  6
                   The highest power of the given polynomial  fx()   is  , we must evaluate the remainders
                                                                        5
                   r r r r r,,,,  4  and  ; then, we will use (7.28), repeated below, to determine p x() .
                                     r
                    0
                      1
                                      5
                                                                                              n
                         2
                            3
                                  p x() =  r +  r x()  1 ()  + r x()  2 ()  +  … +  r n –  1  x () (  n –  1 )  +  r x()  n ()
                                                                                    n
                                   n
                                               1
                                                         2
                                           0
                   We can compute the remainders by long division but, for convenience, we will use the MAT-
                   LAB deconv(p,q) function which divides the polynomial p by q.
                   The MATLAB script is as follows:
                   px=[1  −2   4  0  −1  6];    % Coefficients of given polynomial
                   d0=[1  0];                   % Coefficients of first divisor, i.e, x
                   [q0,r0]=deconv(px,d0)        % Computation of first quotient and remainder
                   d1=[1  −1];                  % Coefficients of second divisor, i.e, x−1
                   [q1,r1]=deconv(q0,d1)        % Computation of second quotient and remainder
                   d2=[1  −2];                  % Coefficients of third divisor, i.e, x−2
                   [q2,r2]=deconv(q1,d2)        % Computation of third quotient and remainder
                   d3=[1  −3];                  % Coefficients of fourth divisor, i.e, x−3
                   [q3,r3]=deconv(q2,d3)        % Computation of fourth quotient and remainder
                   d4=[1  −4];                  % Coefficients of fifth divisor, i.e, x−4
                   [q4,r4]=deconv(q3,d4)        % Computation of fifth quotient and remainder
                   d5=[1  −5];                  % Coefficients of sixth (last) divisor, i.e, x−5
                   [q5,r5]=deconv(q4,d5)        % Computation of sixth (last) quotient and remainder

                   q0 =
                        1    -2     4     0    -1

                   r0 =
                        0     0     0     0     0     6
                   q1 =
                        1    -1     3     3
                   r1 =
                        0     0     0     0     2
                   q2 =
                        1     1     5
                   r2 =

                     0     0     0    13



               Numerical Analysis Using MATLAB® and Excel®, Third Edition                             7−45
               Copyright © Orchard Publications
   318   319   320   321   322   323   324   325   326   327   328