|
|
1.1 root 1: HELP is available
2:
3: NEWS MATLAB NEWS dated 9/15/83.
4: HELP is now a lot faster.
5:
6: INTRO Welcome to MATLAB.
7:
8: Here are a few sample statements:
9:
10: A = <1 2; 3 4>
11: b = <5 6>'
12: x = A\b
13: <V,D> = eig(A), norm(A-V*D/V)
14: help \ , help eig
15: exec('demo',7)
16:
17: For more information, see the MATLAB Users' Guide which is
18: contained in file ... or may be obtained from ... .
19:
20: < < > Brackets used in forming vectors and matrices.
21: <6.9 9.64 SQRT(-1)> is a vector with three elements
22: separated by blanks. <6.9, 9.64, sqrt(-1)> is the same
23: thing. <1+I 2-I 3> and <1 +I 2 -I 3> are not the same.
24: The first has three elements, the second has five.
25: <11 12 13; 21 22 23> is a 2 by 3 matrix . The semicolon
26: ends the first row.
27:
28: Vectors and matrices can be used inside < > brackets.
29: <A B; C> is allowed if the number of rows of A equals
30: the number of rows of B and the number of columns of A
31: plus the number of columns of B equals the number of
32: columns of C . This rule generalizes in a hopefully
33: obvious way to allow fairly complicated constructions.
34:
35: A = < > stores an empty matrix in A , thereby removing it
36: from the list of current variables.
37:
38: For the use of < and > on the left of the = in multiple
39: assignment statements, see LU, EIG, SVD and so on.
40:
41: In WHILE and IF clauses, <> means less than or greater
42: than, i.e. not equal, < means less than, > means greater
43: than, <= means less than or equal, >= means greater than or
44: equal.
45:
46: For the use of > and < to delineate macros, see MACRO.
47:
48: > See < . Also see MACRO.
49:
50: ( ( ) Used to indicate precedence in arithmetic expressions
51: in the usual way. Used to enclose arguments of functions
52: in the usual way. Used to enclose subscripts of vectors
53: and matrices in a manner somewhat more general than the
54: usual way. If X and V are vectors, then X(V) is
55: <X(V(1)), X(V(2)), ..., X(V(N))> . The components of V
56: are rounded to nearest integers and used as subscripts. An
57: error occurs if any such subscript is less than 1 or
58: greater than the dimension of X . Some examples:
59: X(3) is the third element of X .
60: X(<1 2 3>) is the first three elements of X . So is
61: X(<SQRT(2), SQRT(3), 4*ATAN(1)>) .
62: If X has N components, X(N:-1:1) reverses them.
63: The same indirect subscripting is used in matrices. If V
64: has M components and W has N components, then A(V,W)
65: is the M by N matrix formed from the elements of A whose
66: subscripts are the elements of V and W . For example...
67: A(<1,5>,:) = A(<5,1>,:) interchanges rows 1 and 5 of A .
68:
69: ) See ( .
70:
71: = Used in assignment statements and to mean equality in WHILE
72: and IF clauses.
73:
74: . Decimal point. 314/100, 3.14 and .314E1 are all the
75: same.
76:
77: Element-by-element multiplicative operations are obtained
78: using .* , ./ , or .\ . For example, C = A ./ B is the
79: matrix with elements c(i,j) = a(i,j)/b(i,j) .
80:
81: Kronecker tensor products and quotients are obtained with
82: .*. , ./. and .\. . See KRON.
83:
84: Two or more points at the end of the line indicate
85: continuation. The total line length limit is 1024
86: characters.
87:
88: , Used to separate matrix subscripts and function arguments.
89: Used at the end of FOR, WHILE and IF clauses. Used to
90: separate statements in multi-statement lines. In this
91: situation, it may be replaced by semicolon to suppress
92: printing.
93:
94: ; Used inside brackets to end rows.
95: Used after an expression or statement to suppress printing.
96: See SEMI.
97:
98: \ Backslash or matrix left division. A\B is roughly the
99: same as INV(A)*B , except it is computed in a different
100: way. If A is an N by N matrix and B is a column vector
101: with N components, or a matrix with several such columns,
102: then X = A\B is the solution to the equation A*X = B
103: computed by Gaussian elimination. A warning message is
104: printed if A is badly scaled or nearly singular.
105: A\EYE produces the inverse of A .
106:
107: If A is an M by N matrix with M < or > N and B is a
108: column vector with M components, or a matrix with several
109: such columns, then X = A\B is the solution in the least
110: squares sense to the under- or overdetermined system of
111: equations A*X = B . The effective rank, K, of A is
112: determined from the QR decomposition with pivoting. A
113: solution X is computed which has at most K nonzero
114: components per column. If K < N this will usually not be
115: the same solution as PINV(A)*B .
116: A\EYE produces a generalized inverse of A .
117:
118: If A and B have the same dimensions, then A .\ B has
119: elements a(i,j)\b(i,j) .
120:
121: Also, see EDIT.
122:
123: / Slash or matrix right division. B/A is roughly the same
124: as B*INV(A) . More precisely, B/A = (A'\B')' . See \ .
125:
126: IF A and B have the same dimensions, then A ./ B has
127: elements a(i,j)/b(i,j) .
128:
129: Two or more slashes together on a line indicate a logical
130: end of line. Any following text is ignored.
131:
132: ' Transpose. X' is the complex conjugate transpose of X .
133: Quote. 'ANY TEXT' is a vector whose components are the
134: MATLAB internal codes for the characters. A quote within
135: the text is indicated by two quotes. See DISP and FILE .
136:
137: + Addition. X + Y . X and Y must have the same dimensions.
138:
139: - Subtraction. X - Y . X and Y must have the same
140: dimensions.
141:
142: * Matrix multiplication, X*Y . Any scalar (1 by 1 matrix)
143: may multiply anything. Otherwise, the number of columns of
144: X must equal the number of rows of Y .
145:
146: Element-by-element multiplication is obtained with X .* Y .
147:
148: The Kronecker tensor product is denoted by X .*. Y .
149:
150: Powers. X**p is X to the p power. p must be a
151: scalar. If X is a matrix, see FUN .
152:
153: : Colon. Used in subscripts, FOR iterations and possibly
154: elsewhere.
155: J:K is the same as <J, J+1, ..., K>
156: J:K is empty if J > K .
157: J:I:K is the same as <J, J+I, J+2I, ..., K>
158: J:I:K is empty if I > 0 and J > K or if I < 0 and J < K .
159: The colon notation can be used to pick out selected rows,
160: columns and elements of vectors and matrices.
161: A(:) is all the elements of A, regarded as a single
162: column.
163: A(:,J) is the J-th column of A
164: A(J:K) is A(J),A(J+1),...,A(K)
165: A(:,J:K) is A(:,J),A(:,J+1),...,A(:,K) and so on.
166: For the use of the colon in the FOR statement, See FOR .
167:
168: ABS ABS(X) is the absolute value, or complex modulus, of the
169: elements of X .
170:
171: ANS Variable created automatically when expressions are not
172: assigned to anything else.
173:
174: ATAN ATAN(X) is the arctangent of X . See FUN .
175:
176: BASE BASE(X,B) is a vector containing the base B representation
177: of X . This is often used in conjunction with DISPLAY.
178: DISPLAY(X,B) is the same as DISPLAY(BASE(X,B)). For
179: example, DISP(4*ATAN(1),16) prints the hexadecimal
180: representation of pi.
181:
182: CHAR CHAR(K) requests an input line containing a single
183: character to replace MATLAB character number K in the
184: following table. For example, CHAR(45) replaces backslash.
185: CHAR(-K) replaces the alternate character number K.
186:
187: K character alternate name
188: 0 - 9 0 - 9 0 - 9 digits
189: 10 - 35 A - Z a - z letters
190: 36 blank
191: 37 ( ( lparen
192: 38 ) ) rparen
193: 39 ; ; semi
194: 40 : | colon
195: 41 + + plus
196: 42 - - minus
197: 43 * * star
198: 44 / / slash
199: 45 \ $ backslash
200: 46 = = equal
201: 47 . . dot
202: 48 , , comma
203: 49 ' " quote
204: 50 < [ less
205: 51 > ] great
206:
207: CHOL Cholesky factorization. CHOL(X) uses only the diagonal
208: and upper triangle of X . The lower triangular is assumed
209: to be the (complex conjugate) transpose of the upper. If
210: X is positive definite, then R = CHOL(X) produces an
211: upper triangular R so that R'*R = X . If X is not
212: positive definite, an error message is printed.
213:
214: CHOP Truncate arithmetic. CHOP(P) causes P places to be chopped
215: off after each arithmetic operation in subsequent
216: computations. This means P hexadecimal digits on some
217: computers and P octal digits on others. CHOP(0) restores
218: full precision.
219:
220: CLEAR Erases all variables, except EPS, FLOP, EYE and RAND.
221: X = <> erases only variable X . So does CLEAR X .
222:
223: COND Condition number in 2-norm. COND(X) is the ratio of the
224: largest singular value of X to the smallest.
225:
226: CONJG CONJG(X) is the complex conjugate of X .
227:
228: COS COS(X) is the cosine of X . See FUN .
229:
230: DET DET(X) is the determinant of the square matrix X .
231:
232: DIAG If V is a row or column vector with N components,
233: DIAG(V,K) is a square matrix of order N+ABS(K) with the
234: elements of V on the K-th diagonal. K = 0 is the main
235: diagonal, K > 0 is above the main diagonal and K < 0 is
236: below the main diagonal. DIAG(V) simply puts V on the
237: main diagonal.
238: eg. DIAG(-M:M) + DIAG(ONES(2*M,1),1) + DIAG(ONES(2*M,1),-1)
239: produces a tridiagonal matrix of order 2*M+1 .
240: IF X is a matrix, DIAG(X,K) is a column vector formed
241: from the elements of the K-th diagonal of X .
242: DIAG(X) is the main diagonal of X .
243: DIAG(DIAG(X)) is a diagonal matrix .
244:
245: DIARY DIARY('file') causes a copy of all subsequent terminal
246: input and most of the resulting output to be written on the
247: file. DIARY(0) turns it off. See FILE.
248:
249: DISP DISPLAY(X) prints X in a compact format. If all the
250: elements of X are integers between 0 and 51, then X is
251: interpreted as MATLAB text and printed accordingly.
252: Otherwise, + , - and blank are printed for positive,
253: negative and zero elements. Imaginary parts are ignored.
254: DISP(X,B) is the same as DISP(BASE(X,B)).
255:
256: EDIT There are no editing features available on most
257: installations and EDIT is not a command. However, on a few
258: systems a command line consisting of a single backslash \
259: will cause the local file editor to be called with a copy
260: of the previous input line. When the editor returns
261: control to MATLAB, it will execute the line again.
262:
263: EIG Eigenvalues and eigenvectors.
264: EIG(X) is a vector containing the eigenvalues of a square
265: matrix X .
266: <V,D> = EIG(X) produces a diagonal matrix D of
267: eigenvalues and a full matrix V whose columns are the
268: corresponding eigenvectors so that X*V = V*D .
269:
270: ELSE Used with IF .
271:
272: END Terminates the scope of FOR, WHILE and IF statements.
273: Without END's, FOR and WHILE repeat all statements up to
274: the end of the line. Each END is paired with the closest
275: previous unpaired FOR or WHILE and serves to terminate its
276: scope. The line
277: FOR I=1:N, FOR J=1:N, A(I,J)=1/(I+J-1); A
278: would cause A to be printed N**2 times, once for each new
279: element. On the other hand, the line
280: FOR I=1:N, FOR J=1:N, A(I,J)=1/(I+J-1); END, END, A
281: will lead to only the final printing of A .
282: Similar considerations apply to WHILE.
283: EXIT terminates execution of loops or of MATLAB itself.
284:
285: EPS Floating point relative accuracy. A permanent variable
286: whose value is initially the distance from 1.0 to the next
287: largest floating point number. The value is changed by
288: CHOP, and other values may be assigned. EPS is used as a
289: default tolerance by PINV and RANK.
290:
291: EXEC EXEC('file',k) obtains subsequent MATLAB input from an
292: external file. The printing of input is controlled by the
293: optional parameter k .
294: If k = 1 , the input is echoed.
295: If k = 2 , the MATLAB prompt <> is printed.
296: If k = 4 , MATLAB pauses before each prompt and waits for a
297: null line to continue.
298: If k = 0 , there is no echo, prompt or pause. This is the
299: default if the exec command is followed by a semicolon.
300: If k = 7 , there will be echos, prompts and pauses. This is
301: useful for demonstrations on video terminals.
302: If k = 3 , there will be echos and prompts, but no pauses.
303: This is the the default if the exec command is not followed
304: by a semicolon.
305: EXEC(0) causes subsequent input to be obtained from the
306: terminal. An end-of-file has the same effect.
307: EXEC's may be nested, i.e. the text in the file may contain
308: EXEC of another file. EXEC's may also be driven by FOR and
309: WHILE loops.
310:
311: EXIT Causes termination of a FOR or WHILE loop.
312: If not in a loop, terminates execution of MATLAB.
313:
314: EXP EXP(X) is the exponential of X , e to the X . See FUN
315: .
316:
317: EYE Identity matrix. EYE(N) is the N by N identity matrix.
318: EYE(M,N) is an M by N matrix with 1's on the diagonal and
319: zeros elsewhere. EYE(A) is the same size as A . EYE
320: with no arguments is an identity matrix of whatever order
321: is appropriate in the context. For example, A + 3*EYE
322: adds 3 to each diagonal element of A .
323:
324: FILE The EXEC, SAVE, LOAD, PRINT and DIARY functions access
325: files. The 'file' parameter takes different forms for
326: different operating systems. On most systems, 'file' may
327: be a string of up to 32 characters in quotes. For example,
328: SAVE('A') or EXEC('matlab/demo.exec') . The string will be
329: used as the name of a file in the local operating system.
330: On all systems, 'file' may be a positive integer k less
331: than 10 which will be used as a FORTRAN logical unit
332: number. Some systems then automatically access a file with
333: a name like FORT.k or FORk.DAT. Other systems require a
334: file with a name like FT0kF001 to be assigned to unit k
335: before MATLAB is executed. Check your local installation
336: for details.
337:
338: FLOPS Count of floating point operations.
339: FLOPS is a permanently defined row vector with two
340: elements. FLOPS(1) is the number of floating point
341: operations counted during the previous statement. FLOPS(2)
342: is a cumulative total. FLOPS can be used in the same way
343: as any other vector. FLOPS(2) = 0 resets the cumulative
344: total. In addition, FLOPS(1) will be printed whenever a
345: statement is terminated by an extra comma. For example,
346: X = INV(A);,
347: or
348: COND(A), (as the last statement on the line).
349: HELP FLPS gives more details.
350:
351: FLPS More detail on FLOPS.
352: It is not feasible to count absolutely all floating point
353: operations, but most of the important ones are counted.
354: Each multiply and add in a real vector operation such as a
355: dot product or a 'saxpy' counts one flop. Each multiply
356: and add in a complex vector operation counts two flops.
357: Other additions, subtractions and multiplications count one
358: flop each if the result is real and two flops if it is not.
359: Real divisions count one and complex divisions count two.
360: Elementary functions count one if real and two if complex.
361: Some examples. If A and B are real N by N matrices, then
362: A + B counts N**2 flops,
363: A*B counts N**3 flops,
364: A**100 counts 99*N**3 flops,
365: LU(A) counts roughly (1/3)*N**3 flops.
366:
367: FOR Repeat statements a specific number of times.
368: FOR variable = expr, statement, ..., statement, END
369: The END at the end of a line may be omitted. The comma
370: before the END may also be omitted. The columns of the
371: expression are stored one at a time in the variable and
372: then the following statements, up to the END, are executed.
373: The expression is often of the form X:Y, in which case its
374: columns are simply scalars. Some examples (assume N has
375: already been assigned a value).
376: FOR I = 1:N, FOR J = 1:N, A(I,J) = 1/(I+J-1);
377: FOR J = 2:N-1, A(J,J) = J; END; A
378: FOR S = 1.0: -0.1: 0.0, ... steps S with increments of -0.1 .
379: FOR E = EYE(N), ... sets E to the unit N-vectors.
380: FOR V = A, ... has the same effect as
381: FOR J = 1:N, V = A(:,J); ... except J is also set here.
382:
383: FUN For matrix arguments X , the functions SIN, COS, ATAN,
384: SQRT, LOG, EXP and X**p are computed using eigenvalues D
385: and eigenvectors V . If <V,D> = EIG(X) then f(X) =
386: V*f(D)/V . This method may give inaccurate results if V
387: is badly conditioned. Some idea of the accuracy can be
388: obtained by comparing X**1 with X .
389: For vector arguments, the function is applied to each
390: component.
391:
392: HESS Hessenberg form. The Hessenberg form of a matrix is zero
393: below the first subdiagonal. If the matrix is symmetric or
394: Hermitian, the form is tridiagonal. <P,H> = HESS(A)
395: produces a unitary matrix P and a Hessenberg matrix H so
396: that A = P*H*P'. By itself, HESS(A) returns H.
397:
398: HILB Inverse Hilbert matrix. HILB(N) is the inverse of the N
399: by N matrix with elements 1/(i+j-1), which is a famous
400: example of a badly conditioned matrix. The result is exact
401: for N less than about 15, depending upon the computer.
402:
403: IF Conditionally execute statements. Simple form...
404: IF expression rop expression, statements
405: where rop is =, <, >, <=, >=, or <> (not equal) . The
406: statements are executed once if the indicated comparison
407: between the real parts of the first components of the two
408: expressions is true, otherwise the statements are skipped.
409: Example.
410: IF ABS(I-J) = 1, A(I,J) = -1;
411: More complicated forms use END in the same way it is used
412: with FOR and WHILE and use ELSE as an abbreviation for END,
413: IF expression not rop expression . Example
414: FOR I = 1:N, FOR J = 1:N, ...
415: IF I = J, A(I,J) = 2; ELSE IF ABS(I-J) = 1, A(I,J) = -1; ...
416: ELSE A(I,J) = 0;
417: An easier way to accomplish the same thing is
418: A = 2*EYE(N);
419: FOR I = 1:N-1, A(I,I+1) = -1; A(I+1,I) = -1;
420:
421: IMAG IMAG(X) is the imaginary part of X .
422:
423: INV INV(X) is the inverse of the square matrix X . A warning
424: message is printed if X is badly scaled or nearly
425: singular.
426:
427: KRON KRON(X,Y) is the Kronecker tensor product of X and Y . It
428: is also denoted by X .*. Y . The result is a large matrix
429: formed by taking all possible products between the elements
430: of X and those of Y . For example, if X is 2 by 3, then
431: X .*. Y is
432:
433: < x(1,1)*Y x(1,2)*Y x(1,3)*Y
434: x(2,1)*Y x(2,2)*Y x(2,3)*Y >
435:
436: The five-point discrete Laplacian for an n-by-n grid can be
437: generated by
438:
439: T = diag(ones(n-1,1),1); T = T + T'; I = EYE(T);
440: A = T.*.I + I.*.T - 4*EYE;
441:
442: Just in case they might be useful, MATLAB includes
443: constructions called Kronecker tensor quotients, denoted by
444: X ./. Y and X .\. Y . They are obtained by replacing the
445: elementwise multiplications in X .*. Y with divisions.
446:
447: LINES An internal count is kept of the number of lines of output
448: since the last input. Whenever this count approaches a
449: limit, the user is asked whether or not to suppress
450: printing until the next input. Initially the limit is 25.
451: LINES(N) resets the limit to N .
452:
453: LOAD LOAD('file') retrieves all the variables from the file .
454: See FILE and SAVE for more details. To prepare your own
455: file for LOADing, change the READs to WRITEs in the code
456: given under SAVE.
457:
458: LOG LOG(X) is the natural logarithm of X . See FUN .
459: Complex results are produced if X is not positive, or has
460: nonpositive eigenvalues.
461:
462: LONG Determine output format. All computations are done in
463: complex arithmetic and double precision if it is available.
464: SHORT and LONG merely switch between different output
465: formats.
466: SHORT Scaled fixed point format with about 5 digits.
467: LONG Scaled fixed point format with about 15 digits.
468: SHORT E Floating point format with about 5 digits.
469: LONG E Floating point format with about 15 digits.
470: LONG Z System dependent format, often hexadecimal.
471:
472: LU Factors from Gaussian elimination. <L,U> = LU(X) stores a
473: upper triangular matrix in U and a 'psychologically lower
474: triangular matrix', i.e. a product of lower triangular and
475: permutation matrices, in L , so that X = L*U . By itself,
476: LU(X) returns the output from CGEFA .
477:
478: MACRO The macro facility involves text and inward pointing angle
479: brackets. If STRING is the source text for any MATLAB
480: expression or statement, then
481: t = 'STRING';
482: encodes the text as a vector of integers and stores that
483: vector in t . DISP(t) will print the text and
484: >t<
485: causes the text to be interpreted, either as a statement or
486: as a factor in an expression. For example
487: t = '1/(i+j-1)';
488: disp(t)
489: for i = 1:n, for j = 1:n, a(i,j) = >t<;
490: generates the Hilbert matrix of order n.
491: Another example showing indexed text,
492: S = <'x = 3 '
493: 'y = 4 '
494: 'z = sqrt(x*x+y*y)'>
495: for k = 1:3, >S(k,:)<
496: It is necessary that the strings making up the "rows" of
497: the "matrix" S have the same lengths.
498:
499: MAGIC Magic square. MAGIC(N) is an N by N matrix constructed
500: from the integers 1 through N**2 with equal row and column
501: sums.
502:
503: NORM For matrices..
504: NORM(X) is the largest singular value of X .
505: NORM(X,1) is the 1-norm of X .
506: NORM(X,2) is the same as NORM(X) .
507: NORM(X,'INF') is the infinity norm of X .
508: NORM(X,'FRO') is the F-norm, i.e. SQRT(SUM(DIAG(X'*X))) .
509: For vectors..
510: NORM(V,P) = (SUM(V(I)**P))**(1/P) .
511: NORM(V) = NORM(V,2) .
512: NORM(V,'INF') = MAX(ABS(V(I))) .
513:
514: ONES All ones. ONES(N) is an N by N matrix of ones. ONES(M,N)
515: is an M by N matrix of ones . ONES(A) is the same size as
516: A and all ones .
517:
518: ORTH Orthogonalization. Q = ORTH(X) is a matrix with
519: orthonormal columns, i.e. Q'*Q = EYE, which span the same
520: space as the columns of X .
521:
522: PINV Pseudoinverse. X = PINV(A) produces a matrix X of the
523: same dimensions as A' so that A*X*A = A , X*A*X = X and
524: AX and XA are Hermitian . The computation is based on
525: SVD(A) and any singular values less than a tolerance are
526: treated as zero. The default tolerance is
527: NORM(SIZE(A),'inf')*NORM(A)*EPS. This tolerance may be
528: overridden with X = PINV(A,tol). See RANK.
529:
530: PLOT PLOT(X,Y) produces a plot of the elements of Y against
531: those of X . PLOT(Y) is the same as PLOT(1:n,Y) where n is
532: the number of elements in Y . PLOT(X,Y,P) or
533: PLOT(X,Y,p1,...,pk) passes the optional parameter vector P
534: or scalars p1 through pk to the plot routine. The default
535: plot routine is a crude printer-plot. It is hoped that an
536: interface to local graphics equipment can be provided.
537: An interesting example is
538: t = 0:50;
539: PLOT( t.*cos(t), t.*sin(t) )
540:
541: POLY Characteristic polynomial.
542: If A is an N by N matrix, POLY(A) is a column vector with
543: N+1 elements which are the coefficients of the
544: characteristic polynomial, DET(lambda*EYE - A) .
545: If V is a vector, POLY(V) is a vector whose elements are
546: the coefficients of the polynomial whose roots are the
547: elements of V . For vectors, ROOTS and POLY are inverse
548: functions of each other, up to ordering, scaling, and
549: roundoff error.
550: ROOTS(POLY(1:20)) generates Wilkinson's famous example.
551:
552: PRINT PRINT('file',X) prints X on the file using the current
553: format determined by SHORT, LONG Z, etc. See FILE.
554:
555: PROD PROD(X) is the product of all the elements of X .
556:
557: QR Orthogonal-triangular decomposition.
558: <Q,R> = QR(X) produces an upper triangular matrix R of
559: the same dimension as X and a unitary matrix Q so that
560: X = Q*R .
561: <Q,R,E> = QR(X) produces a permutation matrix E , an
562: upper triangular R with decreasing diagonal elements and
563: a unitary Q so that X*E = Q*R .
564: By itself, QR(X) returns the output of CQRDC . TRIU(QR(X))
565: is R .
566:
567: RAND Random numbers and matrices. RAND(N) is an N by N matrix
568: with random entries. RAND(M,N) is an M by N matrix with
569: random entries. RAND(A) is the same size as A . RAND
570: with no arguments is a scalar whose value changes each time
571: it is referenced.
572: Ordinarily, random numbers are uniformly distributed in
573: the interval (0.0,1.0) . RAND('NORMAL') switches to a
574: normal distribution with mean 0.0 and variance 1.0 .
575: RAND('UNIFORM') switches back to the uniform distribution.
576: RAND('SEED') returns the current value of the seed for the
577: generator. RAND('SEED',n) sets the seed to n .
578: RAND('SEED',0) resets the seed to 0, its value when MATLAB
579: is first entered.
580:
581: RANK Rank. K = RANK(X) is the number of singular values of X
582: that are larger than NORM(SIZE(X),'inf')*NORM(X)*EPS.
583: K = RANK(X,tol) is the number of singular values of X that
584: are larger than tol .
585:
586: RCOND RCOND(X) is an estimate for the reciprocal of the
587: condition of X in the 1-norm obtained by the LINPACK
588: condition estimator. If X is well conditioned, RCOND(X)
589: is near 1.0 . If X is badly conditioned, RCOND(X) is
590: near 0.0 .
591: <R, Z> = RCOND(A) sets R to RCOND(A) and also produces a
592: vector Z so that
593: NORM(A*Z,1) = R*NORM(A,1)*NORM(Z,1)
594: So, if RCOND(A) is small, then Z is an approximate null
595: vector.
596:
597: RAT An experimental function which attempts to remove the
598: roundoff error from results that should be "simple"
599: rational numbers.
600: RAT(X) approximates each element of X by a continued
601: fraction of the form
602:
603: a/b = d1 + 1/(d2 + 1/(d3 + ... + 1/dk))
604:
605: with k <= len, integer di and abs(di) <= max . The default
606: values of the parameters are len = 5 and max = 100.
607: RAT(len,max) changes the default values. Increasing either
608: len or max increases the number of possible fractions.
609: <A,B> = RAT(X) produces integer matrices A and B so that
610:
611: A ./ B = RAT(X)
612:
613: Some examples:
614:
615: long
616: T = hilb(6), X = inv(T)
617: <A,B> = rat(X)
618: H = A ./ B, S = inv(H)
619:
620: short e
621: d = 1:8, e = ones(d), A = abs(d'*e - e'*d)
622: X = inv(A)
623: rat(X)
624: display(ans)
625:
626:
627: REAL REAL(X) is the real part of X .
628:
629: RETURN From the terminal, causes return to the operating system
630: or other program which invoked MATLAB. From inside an
631: EXEC, causes return to the invoking EXEC, or to the
632: terminal.
633:
634: RREF RREF(A) is the reduced row echelon form of the rectangular
635: matrix. RREF(A,B) is the same as RREF(<A,B>) .
636:
637: ROOTS Find polynomial roots. ROOTS(C) computes the roots of the
638: polynomial whose coefficients are the elements of the
639: vector C . If C has N+1 components, the polynomial is
640: C(1)*X**N + ... + C(N)*X + C(N+1) . See POLY.
641:
642: ROUND ROUND(X) rounds the elements of X to the nearest
643: integers.
644:
645: SAVE SAVE('file') stores all the current variables in a file.
646: SAVE('file',X) saves only X . See FILE .
647: The variables may be retrieved later by LOAD('file') or by
648: your own program using the following code for each matrix.
649: The lines involving XIMAG may be eliminated if everything
650: is known to be real.
651:
652: attach lunit to 'file'
653: REAL or DOUBLE PRECISION XREAL(MMAX,NMAX)
654: REAL or DOUBLE PRECISION XIMAG(MMAX,NMAX)
655: READ(lunit,101) ID,M,N,IMG
656: DO 10 J = 1, N
657: READ(lunit,102) (XREAL(I,J), I=1,M)
658: IF (IMG .NE. 0) READ(lunit,102) (XIMAG(I,J),I=1,M)
659: 10 CONTINUE
660:
661: The formats used are system dependent. The following are
662: typical. See SUBROUTINE SAVLOD in your local
663: implementation of MATLAB.
664:
665: 101 FORMAT(4A1,3I4)
666: 102 FORMAT(4Z18)
667: 102 FORMAT(4O20)
668: 102 FORMAT(4D25.18)
669:
670: SCHUR Schur decomposition. <U,T> = SCHUR(X) produces an upper
671: triangular matrix T , with the eigenvalues of X on the
672: diagonal, and a unitary matrix U so that X = U*T*U' and
673: U'*U = EYE . By itself, SCHUR(X) returns T .
674:
675: SHORT See LONG .
676:
677: SEMI Semicolons at the end of lines will cause, rather than
678: suppress, printing. A second SEMI restores the initial
679: interpretation.
680:
681: SIN SIN(X) is the sine of X . See FUN .
682:
683: SIZE If X is an M by N matrix, then SIZE(X) is <M, N> .
684: Can also be used with a multiple assignment,
685: <M, N> = SIZE(X) .
686:
687: SQRT SQRT(X) is the square root of X . See FUN . Complex
688: results are produced if X is not positive, or has
689: nonpositive eigenvalues.
690:
691: STOP Use EXIT instead.
692:
693: SUM SUM(X) is the sum of all the elements of X .
694: SUM(DIAG(X)) is the trace of X .
695:
696: SVD Singular value decomposition. <U,S,V> = SVD(X) produces a
697: diagonal matrix S , of the same dimension as X and with
698: nonnegative diagonal elements in decreasing order, and
699: unitary matrices U and V so that X = U*S*V' .
700: By itself, SVD(X) returns a vector containing the singular
701: values.
702: <U,S,V> = SVD(X,0) produces the "economy size"
703: decomposition. If X is m by n with m > n, then only the
704: first n columns of U are computed and S is n by n .
705:
706: TRIL Lower triangle. TRIL(X) is the lower triangular part of X.
707: TRIL(X,K) is the elements on and below the K-th diagonal of
708: X. K = 0 is the main diagonal, K > 0 is above the main
709: diagonal and K < 0 is below the main diagonal.
710:
711: TRIU Upper triangle. TRIU(X) is the upper triangular part of X.
712: TRIU(X,K) is the elements on and above the K-th diagonal of
713: X. K = 0 is the main diagonal, K > 0 is above the main
714: diagonal and K < 0 is below the main diagonal.
715:
716: USER Allows personal Fortran subroutines to be linked into
717: MATLAB . The subroutine should have the heading
718:
719: SUBROUTINE USER(A,M,N,S,T)
720: REAL or DOUBLE PRECISION A(M,N),S,T
721:
722: The MATLAB statement Y = USER(X,s,t) results in a call to
723: the subroutine with a copy of the matrix X stored in the
724: argument A , its column and row dimensions in M and N ,
725: and the scalar parameters s and t stored in S and T
726: . If s and t are omitted, they are set to 0.0 . After
727: the return, A is stored in Y . The dimensions M and
728: N may be reset within the subroutine. The statement Y =
729: USER(K) results in a call with M = 1, N = 1 and A(1,1) =
730: FLOAT(K) . After the subroutine has been written, it must
731: be compiled and linked to the MATLAB object code within the
732: local operating system.
733:
734: WHAT Lists commands and functions currently available.
735:
736: WHILE Repeat statements an indefinite number of times.
737: WHILE expr rop expr, statement, ..., statement, END
738: where rop is =, <, >, <=, >=, or <> (not equal) . The END
739: at the end of a line may be omitted. The comma before the
740: END may also be omitted. The commas may be replaced by
741: semicolons to avoid printing. The statements are
742: repeatedly executed as long as the indicated comparison
743: between the real parts of the first components of the two
744: expressions is true. Example (assume a matrix A is
745: already defined).
746: E = 0*A; F = E + EYE; N = 1;
747: WHILE NORM(E+F-E,1) > 0, E = E + F; F = A*F/N; N = N + 1;
748: E
749:
750: WHO Lists current variables.
751:
752: WHY Provides succinct answers to any questions.
753:
754: EOF End of help file.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.