3. Rows, columns and submatrices
Individual elements of a matrix can be accessed by giving their
subscripts in parentheses, eg. A(1,2), x(i), TAB(ind(k)+1). An expression
used as a subscript is rounded to the nearest integer.
Individual rows and columns c

17
T = '2*A + 3';
S = 'B = >T< + 5'
A = 4;
>S<
produces
B = 16.
Some other examples are given under MACRO in the appendix. This facility is
useful for fairly short statements and expressions. More complicated MATLAB
"programs" should use the EXEC facility

16
5. Commands, text, files and macros.
MATLAB has several commands which control the output format and the overall
execution of the system.
The HELP command allows on-line access to short portions of text describing
various operations, functions and spec

19
which indicates that transformation of the time variable has resulted in a
reasonably well conditioned matrix.
The statement
c = A\y
results in
C =
131.6690
41.0406
103.5396
262.4535
-326.0658
-662.0814
341.9022
533.6373
These are the coefficients in t

many systems create unnecessary underflows and overflows with complex
operations and because some systems do not allow double precision complex
arithmetic.

18
6. Census example
Our first extended example involves predicting the population of the United
States in 1980 using extrapolation of various fits to the census data from
1900 through 1970. There are eight observations, so we begin with the MATLAB
statem

12
Some of these functions have different interpretations when the argument
is a matrix or a vector and some of them have additional optional arguments.
Details are given in the HELP document in the appendix.
Several of these functions can be used in a ge

11
2. MATLAB functions
Much of MATLAB's computational power comes from the various matrix
functions available. The current list includes:
INV(A)
- Inverse.
DET(A)
- Determinant.
COND(A)
- Condition number.
RCOND(A)
- A measure of nearness to singularity.

14
4. FOR, WHILE and IF
The FOR clause allows statements to be repeated a specific number of
times. The general form is
FOR variable = expr, statement, ., statement, END
The END and the comma before it may be omitted. In general, the expression may
be a m

The IF clause allows conditional execution of statements. The general form
is
IF expr relop expr, statement, ., statement,
ELSE statement, ., statement
The first group of statements are executed if the relation is true and the
second group are executed if

1. Elementary operations
MATLAB works with essentially only one kind of object, a rectangular
matrix with complex elements. If the imaginary parts of the elements are all
zero, they are not printed, but they still occupy storage. In some
situations, speci

6
28.7159
Note that both upper and lower case letters are allowed for input (on those
systems which have both), but that lower case is converted to upper case.
There are two "matrix division" symbols in MATLAB, \ and / . (If your
terminal does not have a

4
A=<123
456
789>
To introduce matrices with complex elements, first let j = -1 by typing
J = SQRT(-1).
Then the matrix
C =
1.3 + j5.4
-3.7 - j4.5
3.5 - j4.1
2.7 + j1.6
could be introduced by typing
C = <1.3 + J*5.4 -3.9 - J*4.5
3.5 - J*4.1 2.7 + J*1.6>
M

E =
1.0e-15 *
.3053
-.2498
.0000
The quantity 1.0e-15 is a scale factor which multiplies all the components
which follow. Thus our vectors x and y actually agree to about 15 decimal
places on this computer.
It is also possible to obtain element-by-element

MATLAB Users' Guide
May, 1981
Cleve Moler
Department of Computer Science
University of New Mexico
ABSTRACT. MATLAB is an interactive computer program that serves as a
convenient "laboratory" for computations involving matrices. It provides easy
access to

C =
1.0000 2.0000 3.0000 9.7248
4.0000 5.0000 6.0000 17.6496
7.0000 8.0000 10.0000 28.7159
-3.6000 -1.3000 0.8000 3.1416
There are four predefined variables, EPS, FLOP, RAND and EYE. The
variable EPS is used as a tolerance is determining such things as ne

Together, LINPACK and EISPACK represent the state of the art in software
for matrix computation. EISPACK is a package of over 70 Fortran subroutines
for various matrix eigenvalue computations that are based for the most part on
Algol procedures published

Two consecutive slashes anywhere on a line cause the remainder of the
line to be ignored. This is useful for inserting comments.
Names of variables are formed by a letter, followed by any number of
letters and digits, but only the first 4 characters are r

MATLAB Users' Guide
November, 1980
Cleve Moler
Department of Computer Science
University of New Mexico
MATLAB is an interactive computer program that serves as a convenient
"laboratory" for computations involving matrices. It provides easy access to
matri