LU Decomposition Matlab - LU Factorization Matlab Code


What is LU Decomposition: LU Decomposition (Acronym of Lower-upper Decomposition): In 1948, Alan Turing was the man to introduce the LU Decomposition method to the world. It is a factorization process to convert a given square shape matrix into two triangular matrices (L- Lower triangular and U- Upper triangular matrix). 


Application of LU Decomposition:

  1. This process is used to finding current in a circuit.
  2. To find the inverse of a matrix.
  3. To find the determinant of a matrix.


LU Decomposition or Factorization Matlab Code:

-------------start---------------



GMat=[25 5 1 

      64 8 1

      144 12 1]

shape=size(GMat);

L=eye(shape);

U=GMat;

for i=1:shape(2)-1 

    for j=i+1:shape(1)

        factor=U(j,i)/U(i,i);

        U(j,:)=-(U(i,:)*factor)+U(j,:);

        L(j,i)=factor;

    end

end

L

U



-------------end---------------

The above Matlab code is implemented according to the theory of LU Decomposition.


Matrix for LU


Post a Comment

Previous Post Next Post