10. Consider the system of equations (n = 7) [ [d1 a7] d2 a6 d3 a5 d4 a3 d5 a2 d
ID: 3420402 • Letter: 1
Question
10. Consider the system of equations (n = 7) [
[d1 a7]
d2 a6
d3 a5
d4
a3 d5
a2 d6
[ a1 d7]
For n odd, write and test procedure X Gauss(n, (ai), (di), (bi)) that does the forward elimination phase of Gaussian elimination (without scaled partial pivoting) and procedure X Solve(n, (ai), (di), (bi), (xi)) that does the back substitution for cross-systems of this form
using matlab please show:
(1) the code that solves Ax = b and (2) the code that shows it works.
Explanation / Answer
function x = GaussPP(A,b) %GaussPP(A,b) solves the n-by-n linear system of equations using partial n = size(A,1); %getting n A = [A,b]; %produces the augmented matrix %elimination process starts for i = 1:n-1 p = i; %comparison to select the pivot for j = i+1:n if abs(A(j,i)) > abs(A(i,i)) U = A(i,:); A(i,:) = A(j,:); A(j,:) = U; end end %cheking for nullity of the pivots while A(p,i)== 0 & pRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.