1 Introduction
MATLAB is an interactive computer program that serves as a convenient ”laboratory” for compu-
tations involving matrices. It provides easy access to matrix software developed by the LINPACK
and EISPACK projects [1-3]. The capabilities range from standard tasks such as solving simul-
taneous linear equations and inverting matrices, through symmetric and nonsymmetric eigenvalue
problems, to fairly sophisticated matrix tools such as the singular value decomposition.
It is expected that one of MATLAB’s primary uses will be in the classroom. It should be useful
in introductory courses in applied linear algebra, as well as more advanced courses in numerical
analysis, matrix theory, statistics and applications of matrices to other disciplines. In nonaca-
demic settings, MATLAB can serve as a ”desk calculator” for the quick solution of small problems
involving matrices.
The program is written in Fortran and is designed to be readily installed under any operating
system which permits interactive execution of Fortran programs. The resources required are fairly
modest. There are less than 7000 lines of Fortran source code, including the LINPACK and
EISPACK subroutines used. With proper use of overlays, it is possible run the system on a
minicomputer with only 32K bytes of memory.
The size of the matrices that can be handled in MATLAB depends upon the amount of storage
that is set aside when the system is compiled on a particular machine. We have found that an
allocation of 5000 words for matrix elements is usually quite satisfactory. This provides room for
several 20 by 20 matrices, for example. One implementation on a virtual memory system provides
100,000 elements. Since most of the algorithms used access memory in a sequential fashion, the
large amount of allocated storage causes no difficulties.
In some ways, MATLAB resembles SPEAKEASY [4] and, to a lesser extent, APL. All are
interactive terminal languages that ordinarily accept single-line commands or statements, process
them immediately, and print the results. All have arrays or matrices as principal data types. But
for MATLAB, the matrix is the only data type (although scalars, vectors and text are special cases),
the underlying system is portable and requires fewer resources, and the supporting subroutines are
more powerful and, in some cases, have better numerical properties.
Together, LINPACK and EISPACK represent the state of the art in software for matrix com-
putation. 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 by Wilkinson, Rein-
sch and their colleagues [5]. LINPACK is a package of 40 Fortran subroutines (in each of four
data types) for solving and analyzing simultaneous linear equations and related matrix problems.
Since MATLAB is not primarily concerned with either execution time efficiency or storage savings,
it ignores most of the special matrix properties that LINPACK and EISPACK subroutines use to
advantage. Consequently, only 8 subroutines from LINPACK and 5 from EISPACK are actually
involved.
In more advanced applications, MATLAB can be used in conjunction with other programs in
several ways. It is possible to define new MATLAB functions and add them to the system. With
most operating systems, it is possible to use the local file system to pass matrices between MATLAB
and other programs. MATLAB command and statement input can be obtained from a local file
instead of from the terminal. The most power and flexibility is obtained by using MATLAB as a
subroutine which is called by other programs.
This document first gives an overview of MATLAB from the user’s point of view. Several
extended examples involving data fitting, partial differential equations, eigenvalue sensitivity and
3