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

Chapter 4  Matrices and Determinants



                v1=detd1/delta;                        % Compute the value of v
                                                                                1
                v2=detd2/delta;                        % Compute the value of v
                                                                                2
                v3=detd3/delta;                        % Compute the value of v
                                                                                3
                %
                disp('v1=');disp(v1);                  % Display the value of v
                                                                              1
                disp('v2=');disp(v2);                  % Display the value of v
                                                                              2
                disp('v3=');disp(v3);                  % Display the value of v
                                                                              3
                v1=
                    17/7
                v2=
                   -34/7
                v3=
                   -11/7
                These are the same values as in (4.34)



                4.7  Gaussian Elimination Method

                We can find the unknowns in a system of two or more equations also by the Gaussian elimination
                method. With this method, the objective is to eliminate one unknown at a time. This can be done
                by multiplying the terms of any of the equations of the system by a number such that we can add
                (or subtract) this equation to another equation in the system so that one of the unknowns will be
                eliminated. Then, by substitution to another equation with two unknowns, we can find the sec-
                ond unknown. Subsequently, substitution of the two values found can be made into an equation
                with three unknowns from which we can find the value of the third unknown. This procedure is
                repeated until all unknowns are found. This method is best illustrated with the following example
                which consists of the same equations as the previous example.



                Example 4.11

                Use the Gaussian elimination method to find v v  and v,  1  2 ,  3  of

                                                    2v –  v +  3v =  5
                                                                3
                                                           2
                                                      1
                                                  – 4v –  3v –  2v =  8                                (4.35)
                                                                3
                                                     1
                                                           2
                                                     3v +  v – v =  4
                                                                3
                                                            2
                                                        1
                Solution:
                As a first step, we add the first equation of (4.35) with the third to eliminate the unknown v 2  and
                we obtain the following equation.

               4−20                             Numerical Analysis Using MATLAB® and Excel®, Third Edition

                                                                             Copyright © Orchard Publications
   133   134   135   136   137   138   139   140   141   142   143