echo off disp('MINIMAT will evaluate complicated expressions describing matrix') disp('calculations. It will make up a random matrix of any size:') echo on A = rand(3,5) echo off pause disp(' or a matrix with a specified diagonal: ') echo on D = diag([1,2,3,4]) echo off pause disp('It can calculate the inverse of a matrix: ') echo on A = D+rand(4,4) B=inv(A) echo off pause disp('and multiply matrices (B really is A^(-1) ): ') echo on A*B echo off pause disp('The following illustrates the use of the .m file gj.m ') disp('It computes the Reduced Row Echelon form. ') echo on A=[1 2 3; 4 5 6; 7 8 9] R=gj(A) pause echo off disp('The matrix A has rank 2 so the equations A*X=0 have') disp('a non trivial solution. Using R we can find one. ') pause echo on X=[R(1,3) R(2,3) -1] R*X' A*X' pause echo off disp('The following illustrates the computation of eigenvalues.') disp('The matrix D is a diagonal matrix with the eigenvalues of') disp('of A on the diagonal, and V is a matrix with the') disp('corresponding eigenvectors of A as columns.') echo on A = rand(3,3) pause [V D] = eig(A) echo off pause disp('Note that A*V=V*D:') echo on A*V V*D echo off pause disp('Now we illustrate the singular value decomposition:') echo on A=rand(3,4) pause [U D V]=svd(A) echo off pause disp('note that U and V are orthogonal matrices:') echo on U*U' V*V' echo off pause disp('and that the diagonal matrix D represents A in the new bases:') echo on U*D*V' A echo off pause disp('You can use the cursor keys (press [F2] for help) to examine output') disp('that has scrolled off the screen. The prompt line at the top of the') disp('screen tells you what function keys to use to invoke menus and get') disp('help. Use the command type mmdemo.m to view this batch file') disp('or enter some minimat expressions and/or commands at the #> prompt') disp('Try it yourself!')