1
4.21 Modify the user-defined function GaussPivot in Program 4-2 (Example 4-3) such that in each
step of the elimination the pivot row is switched with the row that has a pivot element with the largest
absolute numerical value. For the function name and arguments use x = GaussPivotLarge(a,b),
where a is the matrix of coefficients, b is the right-hand-side column of constants, and x is the solution.
(a) Use the GaussPivotLarge function to solve the system of linear equations in Eq. (4.17).
(b) Use the GaussPivotLarge function to solve the system:
Solution
The listing of the user-defined function GaussPivotLarge is:
function x = GaussPivotLarge(a,b)
% The function solve a system of linear equations ax=b using the Gauss
03 8 5–1–6
312 4–852–
80 010 3–7
310004
00 4 6–02
30500 6–
x1
x2
x3
x4
x5
x6
34
20
45
36
60
28
=