Professional Documents
Culture Documents
lndas@dce.ac.in
---------------------------------------------------------------------***---------------------------------------------------------------------
Abstract - MATLAB coding which we have executed is 1.2 Required Concepts
not restricted to LU Decomposition only; rather it can be 2.1Rank -The rank of a matrix A is the size of the largest
used for the matrix computation operations such as collection of linearly independent columns of
Cholesky method etc. In the existing MATLAB coding, to 2.2Coefficient Matrix - The coefficient matrix refers to a
solve a system of n linear equations using LU Decomposition, matrix consisting of the coefficients of the variables in a
a pivot matrix is used to reassign the largest element of each set of linear equation.
column to the principal diagonal in the coefficient matrix.
2.3Augmented Matrix -An augmented matrix is a matrix
Whereas in our MATLAB coding the pivot matrix is not
obtained by appending the columns of coefficient matrix
required. In this paper we have executed a MATLAB coding
with the constant matrix, usually for the purpose of
for the solution of a system of n linear equations using LU
performing the same elementary row operations on each
Decomposition
of the given matrices.
Key Words: LU decomposition
2.4Inverse of a Matrix -For a square matrix A, the inverse
1.1 Introduction is written A-1. When A is multiplied by A-1 the result is the
MATLAB is a highly resourceful and useful tool used identity matrix I. Non-square matrices do not have
by a majority of the academic community to create inverses. Not all square matrices have inverses.
models, simulations and solve many problems from
2.5Zero Matrix -A zero matrix is the additive identity of
the fields of engineering, science and mathematics. It
the additive group of matrices.
is particularly known for its ease in handling arrays
and matrices. A lot of in-built functions are provided 2.6Identity Matrix -A square matrix in which all the
to make computation easy. elements of the principal diagonal are ones and all other
elements are zeros. The effect of multiplying a given
In this paper, we have defined a MATLAB coding that matrix by an identity matrix is to leave the given matrix
is useful to solve a system of n linear equations with unchanged.
n variables. In the literature[1], we find that a matrix
called pivot matrix is used to obtain the solution 2.7 Positive Definite Matrix - Asymmetricn
accordingly. In the pivot matrix multiplication, the xnrealmatrixA is said to be positive definite if zTAz is
main aim is to rearrange the columns elements of the positive for every non-zero column vectorz of n real
coefficient matrix, so that the largest element of each numbers. Here zT denotes the transpose of z.
column falls on the principal diagonal. This
pivotization is more time taking. We suggest a new 2.8Matrix Multiplication -
method to overcome these difficulties. In this paper,
we have presented the brief definition and MATLAB Let Am x p and Bp x n be two matrices whose elements are
coding of the LU Decomposition of the coefficient represented by,
matrix of the linear equations, and using this
A = [aij] & B = [bij] for i = 1,2,3,… m and j = 1,2,3,... n.
decomposition have found the solution of the system
of equations. Then their matrix product is given by[2],
AX = B
1. Unique solution
2. Infinite solutions Let A = LU
3. No solution
LUX = B
There are various methods to solve this system of 2.1 MATLAB Functions
equations like substitution, cross-multiplication, matrix The following MATLAB functions[5] have been used in
algebra methods etc. We concentrate here on LU the below defined coding:
Decomposition method.
size(X)returns the row and column size of matrix X.
1.3 LU Decomposition Method
In LU Decomposition[4], every square matrix A can be zeros(m)defines a square zero matrix of size m.
decomposed into a product of a lower triangular matrix L
eye(m)defines an identity matrix of size m.
and an upper triangular matrix U.
2 31end
33
4% LU Decomposition method.
34 symstemp;
5% Input = A, b
35
6% Output = L, U, X
36 L = sym(zeros(n(1)));
7
37 U = sym(eye(n(1)));
8 n = size(A);
38
9
39 T = sym(zeros(n(1)));
10 flag = 1;
40
11
41fori = 1:n(1)
12if( n(1) ~= n(2) )
42 for j = 1:n(1)
13 fprintf('\nNot square matrix\n');
43 if( i>= j )
14 flag = 0;
44 L(i,j) = temp;
15 return;
45 elseU(i,j) = temp;
16end
46 end
17
47 for k = 1:n(1)
18if( flag == 1 )
48 T(i,j) = T(i,j) + L(i,k)*U(k,j);
19 K = [A b];
49 end
20end
50 eq_ans = solve(T(i,j) == A(i,j), temp);
21
51 T(i,j) = eq_ans;
22if( flag == 1 )
52 if( i>= j )
23 if( rank(A) ~= rank(K) )
53 L(i,j) = T(i,j);
24 fprintf('\nNo solution');
54 elseU(i,j) = T(i,j);
25 return;
55 end
26 elseif( rank(A) == rank(K) && rank(A) < n(1) )
56 end
27 fprintf('\nInfinite solutions')
57end
28 return;
58
29 end
© 2015, IRJET.NET- All Rights Reserved Page 628
International Research Journal of Engineering and Technology (IRJET) e-ISSN: 2395 -0056
Volume: 02 Issue: 02 | May-2015 www.irjet.net p-ISSN: 2395-0072
Lines 8-31 are measures taken to check whether A is a 2.4. Advantages of Proposed method
The main advantage of the written coding is to overcome
square matrix. If not, then LU Decomposition cannot be
the problems existing in the given MATLAB coding.
used. These measures also check if the system has a
MATLAB cannot currently handle symbolic matrices;
unique solution or not, by comparing rank of coefficient
rather the coding is supported by symbolic variables. The
matrix, augmented matrix and the number of variables.
coding we have stated is not restricted to LU
The main code where the LU Decomposition is done and Decomposition. It can be used for other matrix
the solution is obtained is contained in lines 34-63. computation operations such as Cholesky Decomposition
etc. In the existing MATLAB coding to solve a system of n
In lines 36 & 37, we initially set zero values to unknown linear equations using LU Decomposition, a pivot matrix is
elements of L&U, thus getting the zero and identity matrix assigned to reassign the order of column elements of the
respectively, both of sizen x n. coefficient matrix. In our coding the pivot matrix is not
required.
This is done because it is known thatL matrix is
lower triangular matrix and U is upper triangular Moreover in our coding it is not needed to specify the
matrix with 1 on diagonals. extrapolation of iterative formula for each method.
a + b − 2c + d + 3e − f = 4
2a − b +c+2d+e − 3f = 20
5a+2b − c − d+2e+ f = −3
−3a − b + 2c + 3d + e + 3f = 16
4a + 3b + c − 6d − 3e − 2f = −27
REFERENCES
[1] http://rosettacode.org/wiki/LU_decomposition -
Creating a MATLAB function
[2] Erwin Kreyszig, Advanced Engineering Mathematics,
9th Edition – page 279
[3] Erwin Kreyszig, Advanced Engineering Mathematics,
9th Edition – page 302
[4] Erwin Kreyszig, Advanced Engineering Mathematics,
9th Edition – page 841
[5] RudraPratap, Getting Started with MATLAB, Oxford
University Press, 2010