No License

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

» Watch video

Highlights from
Row Echelon Form

2.0 | 3 ratings Rate this file 10 Downloads (last 30 days) File Size: 1011 Bytes File ID: #18755 Version: 1.0
image thumbnail

Row Echelon Form



14 Feb 2008 (Updated )

Method for row echelon form of matrix

| Watch this File

File Information

The ref() returns row-echelon-form of nxn matrix.

>> a=[1 2 3 5; 2 4 5 6; 7 3 7 2; 2 4 1 8]
>> ref(a)
result show a row-echelon-form

MATLAB release MATLAB 7 (R14)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (4)
15 Mar 2015 Everett Malone

21 Sep 2009 Evans Doe Ocansey

I tried your code for this matrix
A = [2 3 4 5;6 7 8 9;10 11 12 13; 14 15 16 17];
and the result it's giving me is

1.0000 1.5000 2.0000 2.5000
0 1.0000 2.0000 3.0000

But when I tried it manually I mean with my hands I got zeros replacing of all the places with NaN. Kindly help.

Comment only
05 May 2008 Tim Davis

Warning ... this function does not pivot, which makes it useless for the general case.

The result R=ref(A) can be computed much more simply with [L,U]=lu(A) ; R = diag(diag(U))\U ; so this does not extend MATLAB in any useful way.

So perhaps the code is here just for educational use. However, codes like that must be well commented and well-written; this one is neither. It contains an absurd test (if (i == j)) which by inspection is always true. It contains gems of true absurdity such as statemients like a(i,:)= (1/a(i,j))* a(i,:); Why are you multiplying by the inverse of scalar? That is slow and inaccurate and hard to read. It uses n=length(a(1,:)) simply to determine the dimension of the input matrix a. Finally, the code is pure scalar code with lots of explicit loops.

26 Apr 2008 Henry Andrew

Contact us