**MATLAB Primer**

Second Edition

**Kermit Sigmon**

Department of Mathematics

University of Florida

Department of Mathematics = University of Florida = Gainesville,
FL 32611

sigmon@math.ufl.edu = sigmon@ufpine.bitnet

Copyright © 1989, 1992 by Kermit Sigmon

- Accessing MATLAB
- Entering matrices
- Matrix operations, array operations
- Statements, expressions, variables; saving a session
- Matrix building functions
- For, while, if --- and relations
- Scalar functions
- Vector functions
- Matrix functions
- Command line editing and recall
- Submatrices and colon notation
- M-files
- Text strings, error messages, input
- Managing M-files
- Comparing efficiency of algorithms: flops and etime
- Output format
- Hard copy
- Graphics
- Reference

Copyright © 1989, 1992 by Kermit Sigmon

The MATLAB Primer may be distributed as desired subject to the following conditions:

- It may not be altered in any way, except possibly adding an addendum giving information about the local computer installation or MATLAB toolboxes.
- It, or any part thereof, may not be used as part of a document distributed for a commercial purpose.

In particular, it may be distributed via a local copy center or bookstore. Users usually appreciate the convenience and durability of a bound copy with a cover, copy center style.

Department of Mathematics = University of Florida = Gainesville, FL 32611 sigmon@math.ufl.edu = sigmon@ufpine.bitnet

MATLAB is an interactive, matrix-based system for scientific and engineering calculations. You can solve complex numerical problems without actually writing a program. The name MATLAB is an abbreviation for MATrix LABoratory.

The purpose of this Primer is to help you begin to use MATLAB. They can best be used hands-on. You are encouraged to work at the computer as you read the Primer and freely experiment with examples.

You should liberally use the on-line help facility for more detailed
information. After entering MATLAB as described in section 1, the command
`help`

will display a list of functions for which on-line help
is available; the command `help `

will give
information about a specific function. The command *functionname*`help eig`

,
for example, will give information about the eigenvalue function `eig`

.
You can preview some of the features of MATLAB by entering the command `demo`

.

The scope and power of MATLAB go far beyond these notes. Eventually you will want to consult the MATLAB User's Guide and Reference Guide. The documentation which accompanies the Student Edition of MATLAB is an excellent source. Copies of the complete User's Guide are often available for review at locations such as consulting desks, terminal rooms, computing labs, and the reserve desk of the library. Consult your instructor or your local computing center to learn where the User's Guides are located at your institution.

MATLAB is available for a number of environments: Sun/Apollo/VAXstation/HP workstations, VAX, MicroVAX, Gould, PC and AT compatibles, 80386 and 80486 computers, Apple Macintosh, and several parallel machines. There is a relatively inexpensive Student Edition available from Prentice Hall publishers. The information in these notes applies generally to all of these environments.

While the second edition of the Primer is based on version 3.5 of MATLAB, it is compatible with version 4.0 with the fundamental differences noted. An edition of the Primer based on version 4.0 is under development.

The plain TeX source (and a PostScript file `primer35.ps`

)
of this second edition of the MATLAB Primer is available via anonymous ftp
from `math.ufl.edu`

as the file `primer35.tex`

in
the directory `pub/matlab`

. If ftp is unavailable to you, it
can be obtained via `listserv`

by sending an email message to
`listserv@math.ufl.edu`

which contains the single line ```
send
matlab/primer35.tex
```

. It can also be obtained by sending a request to the author at `sigmon@math.ufl.edu`

.
The latest edition of the Primer will always be available as indicated above
as the file `primer.tex`

. A Spanish version is also available
there.

MATLAB is licensed by The MathWorks, Inc., Cochituate Place, 24 Prime Park Way, Natick, MA 01760, (508)653-1415, Fax: (508)653-2997, Email: info@mathworks.com.

Copyright © 1989, 1992 by Kermit Sigmon (6-93)

Go to Table of Contents .

HTML conversion by martin.ewing@yale.edu, 7/95