Description |
This file contains a function named "elimgauss03" which computes the reduced row echelon form of a matrix using gauss-jordan elimination with partial pivoting. As an attempt to minimize the number of calculations needed, the algorithm does not compute some unnecessary calculations.
For example, given the matrix
A =
16 2 3 13
5 11 10 8
9 7 6 12
The program would first divide the first row by 16. However, since this is done in order to make 1 the element A(1,1), the algorithm only computes A(1,2:end)=A(1,2:end)/A(1,1), and then makes A(1,1)=1.
Similarly, once the former operation is done, we will proceed to make more row operations until the first column of the matrix turns into [1; 0; 0]. The corresponding substractions are not computed, and the instruction A(2:end,1)=0 is used instead.
Thus, we have
ยป elimgauss03(A)
ans =
Columns 1 through 3
1 0 0
0 1 0
0 0 1
Column 4
1
3
-3 |