# Gerald Recktenwald's MATLAB Page

MATLAB is a commercial program for interactive numerical analysis. I use it extensively in my research and teaching, and for many day-to-day tasks, including data reduction, curve fitting, and plotting of technical data.

This page provides a few links to the current and potential MATLAB users. It is not meant as an endorsement.

## Why Use MATLAB for Numerical Computation?

Computer users are susceptible to endless debates on the merits of various hardware manufacturers, operating systems, programming languages, productivity applications, etc. These discussions often devolve into highly emotional and hostile arguments akin to religious or ethnic conflict.

While acknowledging the ultimate futility of arguing whether Bhudda is better than Jesus, or whether Ford is faster than Chevy, it is still useful for those not already familiar with MATLAB to answer the question, ``Why use MATLAB for numerical analysis?''. The answers provided here are not the answers to ``Why is MATLAB better than language X?'', or ``Why is MATLAB better than application Y?''.

MATLAB is useful for numerical analysis for the following reasons.

• It incorporates very high quality software libraries developed by numerical analysts and software developers throughout the world.
• The source code for nearly all of the high level algorithms used by MATLAB is available. MATLAB consists of a highly optimized kernel which handles basic arithmetic and linear algebra operations (LU, Cholesky, QR, and SVD factorizations, eigenvalue computation, sparse matrix manipulation) as well as FFT and inverse FFT. Though the Mathworks customized source code for these functions is not available, the kernels are based on the LAPACK library. The Fortran source for these routines can be downloaded and inspected. The source code for higher level analysis (curve fitting, interpolation, quadrature) is available in the standard MATLAB distribution. This allows users to learn from the source code, and if necessary, to modify that code to meet their own needs
• It is interactive. Substantial analysis can be performed by entering one command at a time and obtaining immediate results. This encourages experimentation, facilitates debugging, and eliminates the ``compile-link-execute'' cycle required by compiled languages.
• It integrates plotting and analysis in one set of commands (one language). This makes it possible to instantly obtain graphical results without having to export data to another program.
• It offers high level abstractions for linear algebra operations. Manipulation of vectors and matrices, including solving linear systems, is supported by intuitive extension of the basic addition, subtraction, multiplication, and division operators.
• It dynamically manages memory for matrices and vectors. This makes it unnecessary to specify the size of matrix and vector variables, and it allows the size of these variables to be changed at will.
• It performs operations on complex and real valued numerical quantities. For example, when the expression y = sqrt(x) is evaluated, MATLAB automatically produces a real or complex y depending on the sign of x.
• It supports structured programming. Software libraries can be developed in MATLAB for sophisticated and highly customized analysis. Furthermore, MATLAB algorithms can be directly translated to C or Fortran, and there is a provision for linking C and Fortran codes to MATLAB.
• It is widely used as a teaching and research tool.

## The Mathworks

MATLAB is sold by the Mathworks, a company in Natick, Massachussets. Their web site is a source of excellent information including reference books, technical notes, and lots of MATLAB source code.

For an ongoing source of information be sure to read the MATLAB newsgroup

## Cleve Moler talks about the origins of MATLAB

The Mathworks created an eight minute movie about the origins of MATLAB. The movie features Cleve Moler, who wrote the first version of MATLAB and who founded the Mathworks with Jack Little. The movie shows photos of a handful of influential mathematicians who developed the first digital algorithms for matrix manipulations. If you have the bandwidth, this movie is definitely worth the time it takes to watch. On 15 Sept 2007 the movie was available as flash movie on this page. (confirmed on 2010-02-20).

## Alternatives to the Commerical Version of MATLAB

The full version of MATLAB is not cheap, although the student version is a good investment at approximately \$100 (US). For a while in the early 2000s, it appeared that the Mathworks was concentrating its efforts on the Windows Operating system. In 2010 MATLAB is available on Windows, Macintosh, Linux and Solaris operating systems. Refer to http://www.mathworks.com/support/sysreq/current_release/ for release notes.

The following list contains alternatives to MATLAB, including free software and similar commericial packages. I have not personally used all of these packages, but you should at least know they exist. Note that Free software means that not only is there no cost for downloading and using the software, but that the source code is available for downloading and inspection. Refer to the Wikipedia article on free software.

R
Software system for statistical analysis and plotting.
Free
Available for Unix/Linux, Wintel PCs and Macintosh.
The Rstudio project provides a MATLAB-like graphical user interface (GUI) for R
In Fall 2009 I began to use R for research that required rigorous statistical analysis. R is powerful and in many ways very satisfying to use. However, one needs to invest time in learning the syntax and idiom of the R language. If you do routine statistical analysis you should at least be aware of R. I learned to use R by consulting the excellent and free documentation and with the help of books by Adler, Teetor, Crawley, Dalgaard, Everitt and Hothorn and Maindonald and Braum. A more complete list of books is available on the web site for the R project.
Scilab
Interactive system for matrix computations.
Free
Available for Unix/Linux, Wintel PCs and Macintosh.
OCTAVE
Interactive system for matrix computations, largely compatible with MATLAB m-files.
Free
Available for Unix/Linux, Wintel PCs and Macintosh.
O-Matrix
Interactive system for matrix computations, with MATLAB compatibility mode that supports MATLAB syntax.
Commercial product with licencing similar to MATLAB
Available for Wintel PCs only.
Python
A scripting language useful for text processing, file manipulation, GUI development, image processing and numeric computation.
I use python (where I used to use perl) for manipulating text files and generating web pages. The Python language has significantly different suntax from MATLAB, and porting MATLAB code to Python requires a good understanding of both languages. Despite this hurdle, some MATLAB programmers are attracted to Python because of its broad capabilities, its ability to do interactive computing, its open source community, and its numeric library called NumPy. The SciPy library library is a relatively new and promising python library for scientific computing. The matplotlib package provides a library of MATLAB-like plotting commands for Python.
Open source with its own Python Software License.
Free
Available for Unix/Linux, Wintel PCs and Macintosh. Python is included in most Linux distributions. Mac OS X comes with the base python package preinstalled. Refer to the official python web site for additional advices. Free binary installers for Windows, Linux, and Mac OS X are available from ActiveState and Enthought.
TeLa the Tesor Language
Interactive system for matrix computations using Fortran-90 style array language.
Free
Available for Unix/Linux.
RLaB
Interactive system for matrix computations. Some MATLAB-like syntax and MATLAB->Rlab converter is available.
Free
Available for Unix/Linux, Wintel PCs and Macintosh.
Yorick
Interactive system for matrix computations.
GPL Freeware and OS-specific binaries
Available for Unix/Linux, Wintel PCs and Macintosh.
EULER
Interactive system for matrix computations.
Free
Available for Unix/Linux, Wintel PCs and Macintosh.
GAUSS
Interactive system for matrix computations.
Commerical Product.
Available for Unix/Linux, and Wintel PCs.
IDL
Interactive Data Language.
Commerical Product available from Exelis
Open source implementation as Gnu Data Language
Available for Unix/Linux, Wintel PCs and Macintosh.

## MATLAB Hypertext Reference

Some years ago I put together an on-line guide to using MATLAB called the MATLAB Hypertext Reference. It hasn't been updated in a long time and there are still quite a few missing pieces. You might find it useful, especially if you are just getting started with MATLAB.

## ME 352, Engineering Numerical Methods

I used to teach our junior level numerical methods course, ME 352. MATLAB is used as the computing and programming environment for that class.