I found that rref in Matlab does the gaussian elimination with patial pivoting Let A for example be a 5x9 matrix:
0.4898 0.2760 0.4984 0.7513 0.9593 0.8407 0.3500 0.3517 0.2858
0.4456 0.6797 0.9597 0.2551 0.5472 0.2543 0.1966 0.8308 0.7572
0.6463 0.6551 0.3404 0.5060 0.1386 0.8143 0.2511 0.5853 0.7537
0.7094 0.1626 0.5853 0.6991 0.1493 0.2435 0.6160 0.5497 0.3804
0.7547 0.1190 0.2238 0.8909 0.2575 0.9293 0.4733 0.9172 0.5678
rref(A) gives:
1.0000 0 0 0 0 10.9716 -6.2494 33.3062 16.0275
0 1.0000 0 0 0 -2.2910 1.6003 -9.5889 -3.9001
0 0 1.0000 0 0 -3.3952 1.8012 -6.8843 -3.4078
0 0 0 1.0000 0 -8.3071 5.8617 -27.3981 -13.0805
0 0 0 0 1.0000 4.2036 -2.4313 11.1545 5.2517
How to obtain the same result as rref by performing LU factorization of A? I found that LU factorization does gauss elimination with partial pivoting as well. How to replace in a code rref with LU? What are the steps to do after [L,U]=lu(A) to obtain the same result as rref(A) of the above example.