LAB-7
LAB-7
LAB REPORT: 7
Class BEE-07
LAB TITLE
Gauss Jordan method and Cramer’s Rule for linear systems of equations, and
Code compilation in MATLAB.
1|Page
EXPERIMENT NUMBER: 7
Introduction
Root Finding Technique (Gauss Jordan method)
The Gauss-Jordan method is similar to the Gaussian elimination process, except that the entries both above and below
each pivot are zeroed out. After performing Gaussian elimination on a matrix, the result is in row echelon form, while
the result after the Gauss Jordan method is in reduced row echelon form.
LAB-TASK
A)
3x1+6x2-9x3 = 15
2x1+4x2-6x3 = 10
-2x1-3x2+4x3 = -6
B)
2x1+1x2-1x3 = 7
3x1-1x2+2x3 = 7
4x1-3x2+1x3 = 1
MATLAB CODE
2|Page
EXPERIMENT NUMBER: 7
% Gauss-Jordan Method (Reduced Echelon Form)
N = length(B);
% Augmented Matrix
Aug = [A B];
end
end
end
Aug
X = Aug(:, N + 1) % Extract solution from the last column of the augmented matrix
Consol Window
3|Page
EXPERIMENT NUMBER: 7
Cramer’s Rule
MATLAB CODE
if N ~= length(B)
end
4|Page
X = zeros(N, 1); % Variable matrix initialized with zero value at start
EXPERIMENT NUMBER: 7
Console Window
5|Page