You are on page 1of 12

W6 CES513 LAB: USING MATLAB

FOR NUMERICAL SOLUTION OF


SIMULTANEOUS EQUATIONS

BY
SYAHRUL FITHRY BIN SENIN
SENIOR LECTURER
LESSON LEARNING OUTCOMES

• to write MATLAB script files that execute the Gauss-Elimination, Gauss-Jordan and LU
Decomposition method on solving simultaneous linear equations (CO2:PO5)
• to write MATLAB script/function file on solving the simultaneous linear equations
(CO2:PO5)
• to run the created MATLAB script/function on some civil engineering examples
(CO2:PO5)
GAUSS ELIMINATION METHOD

Gaussian elimination is a method of solving a linear system Ax =b (consisting of


m equations in n unknowns) by bringing the augmented matrix

to an upper triangular form

This elimination process is also called the forward elimination method.


EXAMPLE

Solve the linear system by Gauss elimination method.

A b
Create Augmented Matrix

Perform Forward Elimination Process (Column 1)

-2R1+R2 -> R2 MEANS "REPLACE ROW 2 WITH THE SUM OF 2


TIMES ROW 1 AND ROW 2".
Perform Forward Elimination Process (Column 2)

R3 + (15/2)R2 -> R3
BACK SUBSTITUTION TO OBTAIN UNKNOWNS

-54 x3 = 108
-2x2+ 6x3= -10
x1-3x2 + x3 = 4
LU DECOMPOSITION METHOD

• LU factorization is a way of decomposing a matrix A into an


upper triangular matrix U, a lower triangular matrix L, and a
permutation matrix P such that PA=LU.
• These matrices describe the steps needed to perform Gaussian
elimination on the matrix until it is in reduced row echelon
form. The L matrix contains all of the multipliers, and the
permutation matrix P accounts for row interchanges.
HOW TO USE LU DECOMPOSITION
COMMAND IN MATLAB TO SOLVE AX = B

[L,U,P] = lu(A)
y = L\(P*b);
x = U\y;
ASSIGNMENT #2 (SUBMISSION ONE WEEK) (12
NOON) (GROUP K)
ASSIGNMENT #2 (SUBMISSION ONE WEEK) (12
NOON) (GROUP E)

You might also like