home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / m / matlab / !Matlab / HLP < prev    next >
Encoding:
Text File  |  1994-03-24  |  30.1 KB  |  826 lines

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