Page 115 - Algorithm Collections for Digital Signal Processing Applications using MATLAB
P. 115

3. Numerical Linear Algebra                                      103

           5.4      M-file for Gram-Schmidt Orthogonalization
                    Procedure



              gramgv.m

              %Given the independent vectors as the input,Orthonormal vectors as the
              %output computed using Gram-Schmidt Orthogonalization procedure
              %Input vectors are arranged rowwise

              function [res]=gramgv(x)

              o{1}=x(1,:)/sqrt(sum(x(1,:).^2));
              for k=2:1:size(x,1)
                  s=x(k,:);
                  for  m=1:1:k-1
                          s=s - ((o{m}*x(k,:)')/(o{m}*o{m}'))*o{m} ;
                  end
                  o{k}=s/sqrt(sum(s.^2));
              end
              res=o;




           6.       COMPUTATION OF THE POWERS
                    OF THE MATRIX ‘A’




           Consider the matrix A =   3    4 . The matrix A 100  is computed as

                                   1    2

              described below.

              The matrix ‘A’ can be diagonalized using eigen matrix ‘E’ (every column
           vector is the eigen vector of the matrix ‘A’) as described in the section 3
   110   111   112   113   114   115   116   117   118   119   120