Page 124 - Applied Numerical Methods Using MATLAB
P. 124

PROBLEMS   113
               (a) Consider the problem of solving

                                                
                                              x 1
                                    123                6
                            A 1 x =           x 2    =  = b 1         (P2.8.3)
                                    246               12
                                              x 3
                   Since this belongs to the underdetermined case (M = 2 < 3 = N), it
                   seems that we can use Eq. (2.1.7) to find the minimum-norm solution.
                   (i) Type the following statements into the MATLAB command window.
                      >>A1 = [1 2 3; 2 4 6]; b1 = [6;12]; x = A1’*(A1*A1’)^-1*b1 %Eq. (2.1.7)
                      What is the result? Explain why it is so and support your answer by
                      typing
                      >>r = rank(A1)

                  (ii) Type the following statements into the MATLAB command window
                      to see the SVD-based minimum-norm solution. What is the value of
                           −1
                                  ˆ ˆ −1 ˆ T
                      x = A b 1 = V S  U b 1 and ||A 1 x − b 1 ||?
                          ˆ
                           1
                      [U,S,V] = svd(A1); %(P2.8.1)
                      u = U(:,1:r); v = V(:,1:r); s = S(1:r,1:r);
                      AIp = v*diag(1./diag(s))*u’; %faked pseudo-inverse (P2.8.2)
                      x = AIp*b1 %minimum-norm solution for singular underdetermined
                      err = norm(A1*x - b1) %residual error


                  (iii) To see that the norm of this solution is less than that of any other
                      solution which can be obtained by adding any vector in the null space
                      of the coefficient matrix A 1 , type the following statements into the
                      MATLAB command window. What is implied by the result?


                      nullA = null(A1); normx = norm(x);
                      for n = 1:1000
                       if norm(x + nullA*(rand(size(nullA,2),1)-0.5)) < normx
                         disp(’What the hell smaller-norm sol - not minimum norm’);
                       end
                      end
               (b) For the problem

                                                
                                               x 1
                                    12    3            6
                             A 2 x =           x 2    =  = b 2        (P2.8.4)
                                    23    4            9
                                               x 3
                   compare the minimum-norm solution based on SVD and that obtained
                   by Eq. (2.1.7).
   119   120   121   122   123   124   125   126   127   128   129