File Exchange

image thumbnail

Gauss-Jordan Elimination with Partial Pivoting

version 1.0 (686 Bytes) by

Gauss-Jordan Elimination with Partial Pivoting

9 Ratings



No License

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

Comments and Ratings (11)

salman nasim

i like it

salman nasim

Tim Davis

Mediocre. This can be done with a single for loop. In addition, the only purpose of this code is for educational uses, since the built-in MATLAB code is vastly superior. This code should thus be loaded with comments to describe what it does. The comments are very terse. In short, this file is rather useless and a distraction to people looking for either (a) real good code to use, or (b) real good code to read for instructional purposes.

abalegn dagnachew

clear and simple code

nasim abbas

it is good site

varin vongmanee

bbb hhh

thank you for help me

Daulet Aktan

Duane Hanselman

This function duplicates what the MATLAB function rref already does. "R = rref(A) produces the reduced row echelon form of A using Gauss Jordan elimination with partial pivoting." There is no need to mimic a function that has been in MATLAB for 20 years.


This is very efficient code.

MATLAB Release
MATLAB 5.3 (R11)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today