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

Solutions to End−of−Chapter Exercises

               1.
                  a.

                      Px=[1  8  10  4]; roots(Px)
                      ans =
                        -6.5708
                        -0.7146 + 0.3132i
                        -0.7146 - 0.3132i
                  b.
                      Py=[1  7  19  25  16  4]; roots(Py)

                      ans =
                        -2.0000
                        -2.0000
                        -1.0000
                        -1.0000 + 0.0000i
                        -1.0000 - 0.0000i
               2.
                  a.

                      r1=[−6.5708  −0.7146+0.3132j  −0.7146−0.3132j]; poly_r1=poly(r1)

                      poly_r1 =  1.0000    8.0000    9.9997    4.0000
                                3
                                       2
                      px() =   x +  8x +   10x +  4
                  b.


                      r2=[−2  −2  −3  −3  −3]; poly_r2=poly(r2)
                      poly_r2 =

                           1    13    67   171   216   108
                                       4
                                5
                                              3
                                                       2
                      pz() =   z +  13z +  67z +  171z +   216z +  108
               3.
                  a.
                      Pv=[1  8  10  4]; value=polyval(Pv, 1.25)

                      value = 30.9531
                  b.

                      Pw=[1  7  19  25  16  4]; value=polyval(Pw, −3.75)

                      value = -63.6904






               Numerical Analysis Using MATLAB® and Excel®, Third Edition                              1−39
               Copyright © Orchard Publications
   47   48   49   50   51   52   53   54   55   56   57