HELP is available NEWS MATLAB NEWS dated 9/15/83. HELP is now a lot faster. INTRO Welcome to MATLAB. Here are a few sample statements: A = <1 2; 3 4> b = <5 6>' x = A\b <V,D> = eig(A), norm(A-V*D/V) help \ , help eig exec('demo',7) For more information, see the MATLAB Users' Guide which is contained in file ... or may be obtained from ... . < < > Brackets used in forming vectors and matrices. <6.9 9.64 SQRT(-1)> is a vector with three elements separated by blanks. <6.9, 9.64, sqrt(-1)> is the same thing. <1+I 2-I 3> and <1 +I 2 -I 3> are not the same. The first has three elements, the second has five. <11 12 13; 21 22 23> is a 2 by 3 matrix . The semicolon ends the first row. Vectors and matrices can be used inside < > brackets. <A B; C> is allowed if the number of rows of A equals the number of rows of B and the number of columns of A plus the number of columns of B equals the number of columns of C . This rule generalizes in a hopefully obvious way to allow fairly complicated constructions. A = < > stores an empty matrix in A , thereby removing it from the list of current variables. For the use of < and > on the left of the = in multiple assignment statements, see LU, EIG, SVD and so on. In WHILE and IF clauses, <> means less than or greater than, i.e. not equal, < means less than, > means greater than, <= means less than or equal, >= means greater than or equal. For the use of > and < to delineate macros, see MACRO. > See < . Also see MACRO. ( ( ) Used to indicate precedence in arithmetic expressions in the usual way. Used to enclose arguments of functions in the usual way. Used to enclose subscripts of vectors and matrices in a manner somewhat more general than the usual way. If X and V are vectors, then X(V) is <X(V(1)), X(V(2)), ..., X(V(N))> . The components of V are rounded to nearest integers and used as subscripts. An error occurs if any such subscript is less than 1 or greater than the dimension of X . Some examples: X(3) is the third element of X . X(<1 2 3>) is the first three elements of X . So is X(<SQRT(2), SQRT(3), 4*ATAN(1)>) . If X has N components, X(N:-1:1) reverses them. The same indirect subscripting is used in matrices. If V has M components and W has N components, then A(V,W) is the M by N matrix formed from the elements of A whose subscripts are the elements of V and W . For example... A(<1,5>,:) = A(<5,1>,:) interchanges rows 1 and 5 of A . ) See ( . = Used in assignment statements and to mean equality in WHILE and IF clauses. . Decimal point. 314/100, 3.14 and .314E1 are all the same. Element-by-element multiplicative operations are obtained using .* , ./ , or .\ . For example, C = A ./ B is the matrix with elements c(i,j) = a(i,j)/b(i,j) . Kronecker tensor products and quotients are obtained with .*. , ./. and .\. . See KRON. Two or more points at the end of the line indicate continuation. The total line length limit is 1024 characters. , Used to separate matrix subscripts and function arguments. Used at the end of FOR, WHILE and IF clauses. Used to separate statements in multi-statement lines. In this situation, it may be replaced by semicolon to suppress printing. ; Used inside brackets to end rows. Used after an expression or statement to suppress printing. See SEMI. \ Backslash or matrix left division. A\B is roughly the same as INV(A)*B , except it is computed in a different way. If A is an N by N matrix and B is a column vector with N components, or a matrix with several such columns, then X = A\B is the solution to the equation A*X = B computed by Gaussian elimination. A warning message is printed if A is badly scaled or nearly singular. A\EYE produces the inverse of A . If A is an M by N matrix with M < or > N and B is a column vector with M components, or a matrix with several such columns, then X = A\B is the solution in the least squares sense to the under- or overdetermined system of equations A*X = B . The effective rank, K, of A is determined from the QR decomposition with pivoting. A solution X is computed which has at most K nonzero components per column. If K < N this will usually not be the same solution as PINV(A)*B . A\EYE produces a generalized inverse of A . If A and B have the same dimensions, then A .\ B has elements a(i,j)\b(i,j) . Also, see EDIT. / Slash or matrix right division. B/A is roughly the same as B*INV(A) . More precisely, B/A = (A'\B')' . See \ . IF A and B have the same dimensions, then A ./ B has elements a(i,j)/b(i,j) . Two or more slashes together on a line indicate a logical end of line. Any following text is ignored. ' Transpose. X' is the complex conjugate transpose of X . Quote. 'ANY TEXT' is a vector whose components are the MATLAB internal codes for the characters. A quote within the text is indicated by two quotes. See DISP and FILE . + Addition. X + Y . X and Y must have the same dimensions. - Subtraction. X - Y . X and Y must have the same dimensions. * Matrix multiplication, X*Y . Any scalar (1 by 1 matrix) may multiply anything. Otherwise, the number of columns of X must equal the number of rows of Y . Element-by-element multiplication is obtained with X .* Y . The Kronecker tensor product is denoted by X .*. Y . Powers. X**p is X to the p power. p must be a scalar. If X is a matrix, see FUN . : Colon. Used in subscripts, FOR iterations and possibly elsewhere. J:K is the same as <J, J+1, ..., K> J:K is empty if J > K . J:I:K is the same as <J, J+I, J+2I, ..., K> J:I:K is empty if I > 0 and J > K or if I < 0 and J < K . The colon notation can be used to pick out selected rows, columns and elements of vectors and matrices. A(:) is all the elements of A, regarded as a single column. A(:,J) is the J-th column of A A(J:K) is A(J),A(J+1),...,A(K) A(:,J:K) is A(:,J),A(:,J+1),...,A(:,K) and so on. For the use of the colon in the FOR statement, See FOR . ABS ABS(X) is the absolute value, or complex modulus, of the elements of X . ANS Variable created automatically when expressions are not assigned to anything else. ATAN ATAN(X) is the arctangent of X . See FUN . BASE BASE(X,B) is a vector containing the base B representation of X . This is often used in conjunction with DISPLAY. DISPLAY(X,B) is the same as DISPLAY(BASE(X,B)). For example, DISP(4*ATAN(1),16) prints the hexadecimal representation of pi. CHAR CHAR(K) requests an input line containing a single character to replace MATLAB character number K in the following table. For example, CHAR(45) replaces backslash. CHAR(-K) replaces the alternate character number K. K character alternate name 0 - 9 0 - 9 0 - 9 digits 10 - 35 A - Z a - z letters 36 blank 37 ( ( lparen 38 ) ) rparen 39 ; ; semi 40 : | colon 41 + + plus 42 - - minus 43 * * star 44 / / slash 45 \ $ backslash 46 = = equal 47 . . dot 48 , , comma 49 ' " quote 50 < [ less 51 > ] great CHOL Cholesky factorization. CHOL(X) uses only the diagonal and upper triangle of X . The lower triangular is assumed to B@ the (complex conjugate) transpose of the upper. If X is positive definite, then R = CHOL(X) produces an upper triangular R so that R'*R = X . If X is not positive definite, an error message is printed. CHOP Truncate arithmetic. Floating-point numbers have 53 bit mantissas whose leading bit is not stored since the numbers are normalized. CHOP(P) truncates the last 4*P bits of each floating-point number for 0 < P < 13 (any other value of P causes full precision to be used.) CHOP(0) restores full precision. CLEAR Erases all variables, except EPS, FLOP, EYE and RAND. X = <> erases only variable X . So does CLEAR X . COND Condition number in 2-norm. COND(X) is the ratio of the largest singular value of X to the smallest. CONJG CONJG(X) is the complex conjugate of X . COS COS(X) is the cosine of X . See FUN . DET DET(X) is the determinant of the square matrix X . DIAG If V is a row or column vector with N components, DIAG(V,K) is a square matrix of order N+ABS(K) with the elements of V on the K-th diagonal. K = 0 is the main diagonal, K > 0 is above the main diagonal and K < 0 is below the main diagonal. DIAG(V) simply puts V on the main diagonal. eg. DIAG(-M:M) + DIAG(ONES(2*M,1),1) + DIAG(ONES(2*M,1),-1) produces a tridiagonal matrix of order 2*M+1 . IF X is a matrix, DIAG(X,K) is a column vector formed from the elements of the K-th diagonal of X . DIAG(X) is the main diagonal of X . DIAG(DIAG(X)) is a diagonal matrix . DIARY DIARY('file') causes a copy of all subsequent terminal input and most of the resulting output to be written on the file. DIARY(0) turns it off. See FILE. DISP DISPLAY(X) prints X in a compact format. If all the elements of X are integers between 0 and 51, then X is interpreted as MATLAB text and printed accordingly. Otherwise, + , - and blank are printed for positive, negative and zero elements. Imaginary parts are ignored. DISP(X,B) is the same as DISP(BASE(X,B)). EDIT There are no editing features available on most installations and EDIT is not a command. However, on a few systems a command line consisting of a single backslash \ will cause the local file editor to be called with a copy of the previous input line. When the editor returns control to MATLAB, it will execute the line again. EIG Eigenvalues and eigenvectors. EIG(X) is a vector containing the eigenvalues of a square matrix X . <V,D> = EIG(X) produces a diagonal matrix D of eigenvalues and a full matrix V whose columns are the corresponding eigenvectors so that X*V = V*D . ELSE Used with IF . END Terminates the scope of FOR, WHILE and IF statements. Without END's, FOR and WHILE repeat all statements up to the end of the line. Each END is paired with the closest previous unpaired FOR or WHILE and serves to terminate its scope. The line FOR I=1:N, FOR J=1:N, A(I,J)=1/(I+J-1); A would cause A to be printed N**2 times, once for each new element. On the other hand, the line FOR I=1:N, FOR J=1:N, A(I,J)=1/(I+J-1); END, END, A will lead to only the final printing of A . Similar considerations apply to WHILE. EXIT terminates execution of loops or of MATLAB itself. EPS Floating point relative accuracy. A permanent variable whose value is initially the distance from 1.0 to the next largest floating point number. The value is changed by CHOP, and other values may be assigned. EPS is used as a default tolerance by PINV and RANK. EXEC EXEC('file',k) obtains subsequent MATLAB input from an external file. The printing of input is controlled by the optional parameter k . If k = 1 , the input is echoed. If k = 2 , the MATLAB prompt <> is printed. If k = 4 , MATLAB pauses before each prompt and waits for a null line to continue. If k = 0 , there is no echo, prompt or pause. This is the default if the exec command is followed by a semicolon. If k = 7 , there will be echos, prompts and pauses. This is useful for demonstrations on video terminals. If k = 3 , there will be echos and prompts, but no pauses. This is the the default if the exec command is not followed by a semicolon. EXEC(0) causes subsequent input to be obtained from the terminal. An end-of-file has the same effect. EXEC's may be nested, i.e. the text in the file may contain EXEC of another file. EXEC's may also be driven by FOR and WHILE loops. EXIT Causes termination of a FOR or WHILE loop. If not in a loop, terminates execution of MATLAB. EXP EXP(X) is the exponential of X , e to the X . See FUN . EYE Identity matrix. EYE(N) is the N by N identity matrix. EYE(M,N) is an M by N matrix with 1's on the diagonal and zeros elsewhere. EYE(A) is the same size as A . EYE with no arguments is an identity matrix of whatever order is appropriate in the context. For example, A + 3*EYE adds 3 to each diagonal element of A . FILE The EXEC, SAVE, LOAD, PRINT and DIARY functions access files. The 'file' parameter takes different forms for different operating systems. On most systems, 'file' may be a string of up to 32 characters in quotes. For example, SAVE('A') or EXEC('matlab/demo.exec') . The string will be used as the name of a file in the local operating system. On all systems, 'file' may be a positive integer k less than 10 which will be used as a FORTRAN logical unit number. Some systems then automatically access a file with a name like FORT.k or FORk.DAT. Other systems require a file with a name like FT0kF001 to be assigned to unit k before MATLAB is executed. Check your local installation for details. FLOPS Count of floating point operations. FLOPS is a permanently defined row vector with two elements. FLOPS(1) is the number of floating point operations counted during the previous statement. FLOPS(2) is a cumulative total. FLOPS can be used in the same way as any other vector. FLOPS(2) = 0 resets the cumulative total. In addition, FLOPS(1) will be printed whenever a statement is terminated by an extra comma. For example, X = INV(A);, or COND(A), (as the last statement on the line). HELP FLPS gives more details.