Page 233 - MATLAB an introduction with applications
P. 233

218 ———  MATLAB: An Introduction with Applications

                   Matrix in tridiagonal form is

                         4.0000 –3.7417        0            0
                        –3.7417 14.5714        2.6245       0
                         0         2.6245      2.6878      –0.7622
                         0         0          –0.7622       2.7407
                   Example E4.4:  Use the QR factorization method with Householder transformation to calculate the eigen-
                   values and the corresponding eigenvectors of the matrix [K], where
                                       5  − 4  1   0 
                                      − 4  6  − 4  1 
                                [] =                 
                                 K
                                       1  − 4  6  − 4 
                                                     
                                        0  1  − 4  5  
                   Solution:
                   MATLAB Solution [Using built-in function]:
                   >> A = [5 – 4 1 0; – 4 6  – 4 1; 1– 4 6 – 4; 0 1 –4 5];
                   >> kmax = 200;
                   >> [eigs,A] = eig_QR(A, kmax)
                   eigs =
                        13.0902
                         6.8541
                         1.9098
                         0.1459
                   A =
                        13.0902        0.0000       0.0000      –0.0000
                        –0.0000        6.8541       0.0000       0.0000
                         0.0000      –0.0000        1.9098       0.0000
                         0             0          –0.0000        0.1459
                   >> A = [5 – 4 1 0; – 4 6 – 4 1;1 – 4 6 – 4;0 1 – 4 5];
                   >> [Q,d] = eig(A)
                   Q =
                       – 0.3717      – 0.6015       0.6015     – 0.3717
                       – 0.6015      – 0.3717     – 0.3717       0.6015
                       – 0.6015       0.3717      – 0.3717     – 0.6015
                       – 0.3717       0.6015        0.6015       0.3717
                   d =
                         0.1459        0            0            0
                         0             1.9098       0            0
                         0             0            6.8541       0
                         0             0            0           13.0902
   228   229   230   231   232   233   234   235   236   237   238