Gaussian Elimination Matlab Code and Applications

What is Gaussian Elimination (Also known as row reduction process): Gaussian Elimination is a technique of row reduction method in a linear equation. For the reduction number of rows in the linear equation, the equation needs to be transformed in matrix format. This type of numerical analysis algorithm was first used by Carl Friedrich Gauss in 1810. 


Application of Gaussian Elimination:

  1. This algorithm is used for solving a linear equation.
  2. To solve linear equations or mesh-connected processors.
  3. To minimize a linear equation.
  4. Fingerprint Image Improvement through a gaussian filtering process in the image processing system.
  5. To solve a scheduling algorithm in Operating System.


Gaussian Elimination Matlab Code:

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


Mat_Left_side = [25 5 1
64 8 1
144 12 1]
Mat_Left_side = 3×3
25 5 1
64 8 1
144 12 1
Mat_Right_side=[106.8;177.2;279.2]
Mat_Right_side = 3×1
106.80
177.20
279.20
Merge_Mat = [Mat_Left_side Mat_Right_side];
[row,column] = size(Merge_Mat);
%Part 1: Forward elemination
for j=1:row
for i = j+1:row
Merge_Mat(i,:) = Merge_Mat(i,:) - (Merge_Mat(i,j).*Merge_Mat(j,:))./Merge_Mat(j,j) ;
end
end
Merge_Mat
Merge_Mat = 3×4

25.0 5.0 1.0 106.80
0 -4.800 -1.56 -96.2080
0 0 0.7 0.7600
Merge_Mat(1:3,1:3) %The Final Forward elimination matrix
ans = 3×3

25.00 5.0 1.0
0 -4.8 -1.56
0 0 0.70
%Part 2: Back substitution
Final_Right_side_Mat = Merge_Mat(row,column)/Merge_Mat(row,row);
for i = row:-1:2
mat = Merge_Mat(i-1,i:row);
Final_value = (Merge_Mat(i-1,column)-(mat*Final_Right_side_Mat))/(Merge_Mat(i-1,i-1));
Final_Right_side_Mat = [Final_value;Final_Right_side_Mat];
end
Final_value
Final_value = 0.2905
Final_Right_side_Mat %The Final Back substitution matrix
Final_Right_side_Mat = 3×1
0.2905
19.6905
1.0857

Post a Comment

Previous Post Next Post