Gaussian Elimination - Code Answer Flashcards
1
Q
What does the ‘for i = 1:n-1;’ loop consist of?
A
for ir = i+1:neqns; fact = k(ir, i) / k(i, i); k(ir, i:n) = k(ir, i:n) - k(i, i:n)*fact; p(ir) = p(ir) - p(i)*fact; end
2
Q
What lines come under ‘%Backsubstitution’?
A
u(1:n) = 0; u(n) = p(n) / k(n, n);
for i = n-1 : -1 : 1;
u(i) = p(i) / k(i, i) - (k(i, i+1 : n * u(i+1 : r)’) / k(i, i);