Complete Textbook problem 9.18 using Matlab (you can use a 10^-6 as your tolerance) a. Format...
Complete Textbook problem 9.18 using Matlab (you can use a 10^-6 as your tolerance) a. Format your function such that [x] = lastname_firstname_GaussPivot(A, b). Submit your original M-file. Develop, debug, and test a program in either a high-level language or macro language of your choice to solve a system of equations with Gauss elimination with partial pivoting. Base the program on the pseudocode from Fig. 9.6. Test the program using the following system (which has an answer of x_1 = x_2 = x_3 = 1), x_1 + 2x_2 - x_3 = 2 5x_1 + 2x_2 + 2x_3 = 9 -3x_1 + 5x_2 = x_3 = 1 SUB Gauss (a. b. n, x, tol, er) DIMENSION s(n) er = 0 DOFOR 7 = 1, n Sj = ABS(aKJ) DOFOR j = 2, n IF ABS(au)>Si THEN s, = ABS(au END DO END DO CALL Eliminate(a. s, n, b, tol, er) IF er * -1 THEN CALL Substitute(a, n, b, x) END IF END Gauss SUB Eliminate (a, s, n, b, tol, er) DOFOR k = 1, n - 1 CALL Pivot (a, b, s, n, k) IF ABS (ak, k/sk) < tol THEN er = -1 EXIT DO END IF DOFOR i = k + 1, n factor = aUk/akrk DOFOR j = k + 1, n tfj = du ~ factor*akJ END DO b, - = bj - factor * bk END DO END DO IF ABS(an n/sn) < tol THEN er = -I END Eliminate SUB Pivot (a, b, s, n, k) P = k big = ABS(aktk/sk) DOFOR 77 = k + 1, n dummy = ABS(a11>k/s^) IF dummy > big THEN j) big = dummy P = 77 END IF END DO IF p* k THEN DOFOR jj = k, n dummy = apjj dp.Jj = ak, jj akJJ = dummy END DO dummy = bp bp = bk bk = dummy dummy = sp sp = sk sk = dummy END IF END pivot SUB Substitute (a, n, b, x) xn - bj anjn DOFOR 7 = n - 1. 1, -1 sum = 0 DOFOR j = 7 + 1, n sum = sum + afJ * Xj END DO Xf = (bj - sum)/au1 END DO END Substitute