October 1996 € Volume 23 € Number 5

Software Review

Interactive mathematical package offers high-performance numeric computing and visualization

By John J. Hutchinson

A wide variety of interactive mathematical software packages are now available for mathematics and engineering education and applications. Most incorporate easy-to-use graphical user interfaces and other powerful graphical capabilities. These packages fall into two rough categories. The first category consists of algebraic systems which carry out symbolic calculations. This market is dominated by Maple and Mathematica. The second category is characterized by a numeric computing environment for high-performance computation and visualization. MATLAB and MATRIXx are examples of products in this category. The symbolic software packages and the numeric software packages both do some of the same things, and can be made to do many of the same things, but there are important differences between them. The symbolic packages are best at performing algebraic and analytic operations on equations, even equations involving matrices. The numeric packages can handle larger production type problems and are typically faster and better numerically.

MATLAB is an interactive, high-performance numeric computational software system. The name stands for matrix laboratory, and the matrix is the basic unit of computation. Matrices are easily entered and do not require dimensioning. MATLAB allows intuitive manipulation of matrix rows, columns, individual elements and submatrices. The language allows for the usual set of matrix operations and functions (inverses, LU decompositions, determinants, eigenvalues, eigenvectors, rank, and singular value decompositions). These functions can be augmented by user-created macros called M-files. A rich set of M-files is included. The system is open in that the source code for these files can be copied and customized to create new M-files that extend the operations to better meet the user's needs. A new M-file debugging facility has been added which allows the user to single step through a file and examine variables. All M-files share a common environment and can be used together seamlessly.

MATLAB can handle sparse matrices efficiently and has numerous data analysis, statistical, differential equations, and nonlinear numerical methods functions.

MATLAB commands are entered at a command line. The user may use the arrow keys on the keypad to edit mistyped commands or recall a previous command. A full-page Windows-type editor would be more natural since there is a tendency to go back and edit an incorrect command rather than call it back at the command line and edit it there. The diary function may be used to journal commands and output to a text file. Users can run the resulting file from the command line or modify it, as needed, converting it into a generalized M-file. The "diary" command can be included in the MATLAB start-up script to automatically invoke the journaling capability at the beginning of each session.

MATLAB has the usual control flow statements found in most programming languages. In many cases, these constructs can also be vectorized to generate even faster execution. Better performance can be obtained with MEX (MATLAB EXecutable) files. MEX-files are C or FORTRAN programs that can be called directly from within MATLAB. That is, a dynamic linking facility allows direct linkage to C or FORTRAN programs at run time. There are several ways to introduce data from other programs.

The 2-D and 3-D graphics provide production quality, object-oriented graphs in all the standard scientific and engineering formats that one could want. Enhancements such as surface rendering, pseudocolor, light sources and animation are easily used. Labels, titles, grids and colors are easily inserted and modified. It is especially useful to be able to make quick changes in the grid size for graphs. A relatively course grid size speeds up the debugging process and a bit of experimentation will make the grid size "just right" for screen presentation or for printed graphics. It is easy to move graphics between MATLAB and most word processors with the Windows clipboard.

MATLAB also offers an array of application-specific tools called toolboxes (signal processing, symbolic math, fuzzy logic, etc.), as well as a simulation/modeling environment called SIMULINK. SIMULINK is an extension which provides a block-diagram environment for modeling, analyzing and simulating a broad range of dynamic non-linear systems.

Program installation is routine with no problems for Windows, Windows 95 or Windows NT. Installation takes about 30 minutes. If the user is going to create MEX-files, it is necessary to select a FORTRAN or C compiler during the installation procedure. The software comes with a User's Guide and a Reference Guide. The User's Guide contains a tutorial which is quite readable with enough examples to obtain a fair understanding of the software. The Reference Guide is an alphabetically arranged reference to all features of MATLAB. A Windows-style help facility provides on-line help which consists of both reference and examples.

The tutorial could be improved for beginners if the authors gave more explanations and examples of some of the finer points of array operations. For instance, the symbols * \ / ^ and ' denote the usual linear algebra matrix operations, and a period (.) preceding an operator indicates an array or element-by-element operation. This distinction is easily forgotten later in the guide when a beginner modifies an example and executes statements such as:


This will produce a nice plot of sin(x) from - to . However, the statements:


will produce an error. The program cannot raise the vector x to the second power. This can be corrected by changing the second line to y=x.^2+2*x-1 since the (easy to overlook) dot is needed to indicate vector operation for exponentiation even though it is optional for multiplication of x by 2.

Users may write their own M-file functions. These functions may accept, operate on, and optionally return multiple matrix, vector and scalar values. Users have the option of designing their functions to perform matrix operations on the inputs or, alternatively, to develop functions that operate on the input data in an element-by-element fashion (or both).

Depending on the method chosen, users should be careful to ensure that the format of the return values is consistent with the format of the input data. It takes a very careful reading of the tutorial and some trial and error to appreciate these distinctions because they present no problem for intrinsic or built-in functions, which all work with matrix arguments. Where there might be ambiguity, a distinction is made, such as between exp(A) and the transcendental matrix function expm(A).

Subscripts are rounded to the nearest integer. For instance, if A is a 3x6 matrix, then A(2.35,6.456) is the second row, sixth column of A while A(2.35,6.56) gives a "Index exceeds matrix dimensions" error. This feature would be more valuable if the indices are rounded down. The desired result can be obtained with the rather inelegant MATLAB command A(floor(2.35),floor(6.56)).

Some examples of graphics
The following is an example of a plot of sin(.1(x2-4x-3)) and .1(x2-4x-3) from -10 to 10 on the same graph with the first graph printed with a solid (yellow on screen [arcing line, below]) line and the second with a solid (magenta on screen [oscillating line, below]) line.


Figure 1

The following is an example of a graph of the given function of two variables from -50 to 50, with points plotted at intervals of 2, an azimuth of 75°, and an elevation of 60°.


Figure 2

Other features
The PC and Mac versions of the program are shipped with the MATLAB Notebook. On the PC, the Notebook establishes a Dynamic Data Exchange (DDE) conversation between MATLAB and Microsoft Word. This allows the user to create interactive word processing documents which include executable MATLAB commands and their output. Graphs are easily incorporated in the text. This feature is especially handy for preparing technical reports and class notes. Also included in the Mac product is a path manager, workspace browser and matrix editor.

MATLAB provides good technical support as well as training courses. Internet users have access to electronic mail support as well as other resources. The World Wide Web has extensive elementary and advanced information. The MathWorks FAQ-files (frequently asked questions) are especially helpful. By becoming a subscribing user you receive the quarterly MathWorks Newsletter, the MATLAB News Digest (e-mail) and other technical support. There is a rich variety of mathematics and engineering textbooks which utilize MATLAB to varying degrees. Some of the ones that integrate MATLAB in their examples and exercises are given in the bibliography. The MathWorks News Digest contains several reviews of these books.

1. R. Biran and M. Breiner, "MATLAB for Engineers," Addison-Wesley, 1995.

2. T. Harrison, "MATLAB," OR/MS Today, December 1991.

3. L. Jackson, "Signals, Systems, and Transforms," Addison-Wesley, 1991.

4. C. Kelly, "Iterative Methods for Linear and Nonlinear Equations," SIAM, 1995.

5. M. Marcus, "Matrices and MATLAB," Prentice Hall 1993.

6. L. Strassberg, "A review of PC-MATLAB," OR/MS Today, October 1985.

John Hutchinson is a professor of mathematics and statistics and the director of operations at the National Institute for Aviation Research at Wichita State University.

Vendor & Product Information

MATLAB is available on personal computers, minicomputers and supercomputers. User-generated data and files are transferable across platforms without modification. The Windows-based PC versions of MATLAB require an Intel-based 486 or Pentium processor with 8MB of memory and 15MB of free space on a hard drive. Additional memory and other Microsoft Windows-supported printers and cards are recommended. In order to run MEX-files, a specific Microway NDP FORTRAN compiler or a Metaware High C, Microsoft Visual C/C++, Borland C/C++, or WATCOM C/C++ compiler is required.

MATLAB 4.2c and the related toolboxes are available from The MathWorks, Inc., 24 Prime Park Way, Natick, MA 01760-1500; Phone: (508)-653-1415; Fax: (508)-653-6284; e-mail: info@mathworks.com; WWW: http://www.mathworks.com.

Pricing for MATLAB for Windows in the U.S. begins at $1,695; update pricing is $195 for MATLAB 4.0 customers. The educational price ranges from $495 for a single user to $3,750 for 20 users. A Classroom Kit is available for $795 which can be used in a laboratory for academic credit.

Software Correspondence

Correspondence regarding the software reviews should be sent to OR/MS Today software review editor, Saba Bahouth. Individuals intersted in reviewing software for OR/MS Today or companies looking to have their products reviewed in the magazine should contact Bahouth directly at the University of Central Oklahoma. College of Business Administration, Edmond, OK 73034-5209; Phone: (405) 341-2980, ext. 2163; Fax: (405) 330-3821; e-mail: bahouth@aix1.ucok.edu

For more information, put the number 8 in the appropriate space on the
Reader Service Form

OR/MS Today copyright © 1996 by the Institute for Operations Research and the Management Sciences. All rights reserved.
Click here to return to the table of contents.