1 MATLAB
• Matlab is an interactive system for doing nu-
merical computations.
• A numerical analyst called Cleve Moler wrote
the first version of Matlab in the 1970s. It
has since evolved into a successful commercial
software package.
• Matlab relieves you of a lot of the mundane
tasks associated with solving problems nu-
merically. This allows you to spend more time
thinking, and encourages you to experiment.
• Matlab makes use of highly respected algo-
rithms and hence you can be confident about
your results.
• Powerful operations can be performed using
just one or two commands.
• You can build up your own set of functions
for a particular application.
• Excellent graphics facilities are available, and
the pictures can be inserted into L
A
T
E
X and
Word documents.
These notes provide only a brief glimpse of the
power and flexibility of the Matlab system. For a
more comprehensive view we recommend the book
Matlab Guide
D.J. Higham & N.J. Higham
SIAM Philadelphia, 2000, ISBN: 0-89871-469-9.
2 Starting Up
2.1 Windows Systems
On Windows systems MATLAB is started by double-
clicking the MATLAB icon on the desktop or by
selecting MATLAB from the start menu.
The starting procedure takes the user to the Com-
mand window where the Command line is indicated
with ’>>’. Used in the calculator mode all Matlab
commands are entered to the command line from
the keyboard.
Matlab can be used in a number of different ways or
modes; as an advanced calculator in the calculator
mode, in a high level programming language mode
and as a subroutine called from a C-program. More
information on the first two of these modes is given
below.
Help and information on Matlab commands can be
found in several ways,
• from the command line by using the ’help
topic’ command (see below),
• from the separate Help window found under
the Help menu or
• from the Matlab helpdesk stored on disk or
on a CD-ROM.
Another useful facility is to use the ’lookfor keyword’
command, which searches the help files for the key-
word. See Exercise 16.1 (page 17) for an example
of its use.
2.2 Unix Systems
• You should have a directory reserved for sav-
ing files associated with Matlab. Create such
a directory (mkdir) if you do not have one.
Change into this directory (cd).
• Start up a new xterm window (do xterm & in
the existing xterm window).
• Launch Matlab in one of the xterm windows
with the command
matlab
After a short pause, the logo will be shown
followed by a window containing the Matlab
interface. Should you wish to run Matlab in
an xterm window, use the command
matlab -nojvm
and, following dislpay of the logo, the Matlab
prompt >> will appear.
Type quit at any time to exit from Mat-
lab.
2.3 Command Line Help
Help is available from the command line prompt.
Type help help for “help” (which gives a brief syn-
opsis of the help system), help for a list of topics.
The first few lines of this read
HELP topics:
matlab/general - General purpose commands.
matlab/ops - Operators and special char...
matlab/lang - Programming language const...
matlab/elmat - Elementary matrices and ma...
matlab/elfun - Elementary math functions.
matlab/specfun - Specialized math functions.
(truncated lines are shown with . . . ). Then to ob-
tain help on “Elementary math functions”, for instance,
type
>> help elfun
2