Question: function x = gaussJordan ( A , B ) % Solve Ax = B by Gauss - Jordan elimination algorithm. [ NA , ~ ]
function x gaussJordanA B
Solve Ax B by GaussJordan elimination algorithm.
NA ~ sizeA;
~ NB sizeB;
if NB ~ NA
errorA and B must have compatible dimensions';
end
N NA NB;
AB A B;
for k :NA
Scaled Partial Pivoting
akx kx maxabsABk:NA k maxabsABk:NA k:NA;
if akx eps
errorSingular matrix and No unique solution';
end
mx k kx ;
if kx
tmprow ABk :;
ABk :) ABmx :;
ABmx :) tmprow;
end
Gauss forward and backward elimination
pivot ABk k;
ABk :) ABk :) pivot;
for m :NA
if m ~ k
ABm :) ABm :) ABm k ABk :;
end
end
end
x AB: NA:N;
end
modify the function gaus into gausj that implements GausJordan elimination algorithm and show that the function is indeed working.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
