Gaussian Elimination is an orderly process of transforming an augmented matrix i
ID: 3568222 • Letter: G
Question
Gaussian Elimination is an orderly process of transforming an augmented matrix into an equivalent upper Matlab which square nxn) and a column vector b (dimensions nx1) and implements the Gaussian elimination algorithm: form G IA bj or i 1. n-1 for k it 1 n for j i n 1 end end end G is the matrix of the augmented system [A bl. The function should return the upper triangular matrix U and the new column vector c with the constant terms of the resulting system of linear equations in triangular form For example, if you call mygauss with input arguments A -3 2 -1 the function should return: 0 -2 5 0 0 -2Explanation / Answer
A = [-3, 2, -1,
6, -6, 7,
3, -4, 4];
b = [-1,
-7,
-6];
G=[A,b];
A
b
x=0;
n = 3;
for i=1:n-1
for k=i+1:n
m=G(k,i)/G(i,i);
for j=i:n+1
G(k,j)=G(k,j)-m*G(i,j);
end
end
end
disp('After using gaussian elimination: ');
U=0;
c=0;
for i=1:n
for j=1:n
U(i,j) = G(i, j);
end
end
for i=1:n
c(i,1) = G(i, 4);
end
U
c
--------------------------------------------------------------
OUTPUT
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.