disp('A semi-automatic example for Gauss-Jordan elimination') pause disp('First create a random matrix') A=rand(4,5) pause disp('Then make this into an integer matrix with reasonable numbers') A=100*A A1=floor(A) pause disp('Unless the random number generator created some zeros we need') disp('not make row interchanges -- else simply start over again, or') disp('use a more sophisticated program that checks for zero entries.') % pause disp('Forward elimination: The first column.') A2=r1(A1,1,1/A1(1,1)) pause A3=r3(A2,1,-A2(2,1),2) pause A4=r3(A3,1,-A3(3,1),3) pause A5=r3(A4,1,-A4(4,1),4) pause disp('Forward elimination: The second column.') A6=r1(A5,2,1/A5(2,2)) pause A7=r3(A6,2,-A6(3,2),3) pause A8=r3(A7,2,-A7(4,2),4) pause disp('Forward elimination: The third column.') A9=r1(A8,3,1/A8(3,3)) pause A10=r3(A9,3,-A9(4,3),4) pause disp('Forward elimination: The fourth column.') A11=r1(A10,4,1/A10(4,4)) pause disp('Backward elimination: The fourth column.') A12=r3(A11,4,-A11(1,4),1) pause A13=r3(A12,4,-A12(2,4),2) pause A14=r3(A13,4,-A13(3,4),3) pause disp('Backward elimination: The third column.') A15=r3(A14,3,-A14(1,3),1) pause A16=r3(A15,3,-A15(2,3),2) pause disp('Backward elimination: The second column.') A17=r3(A16,2,-A16(1,2),1) pause disp('And a little faster using rrefmovy') A1=A; rrefmovy(A1) pause disp('Next using the MATLAB built-in rrefmovie') pause A1=A; rrefmovie(A1) pause disp('And finally, we no longer care about the intermediate steps:') A1=A; rref(A)