**MATLAB**, short for "matrix laboratory", refers to both the numerical computing environment and to its core programming language. Created by *The MathWorks*, MATLAB allows one to easily manipulate matrices, plot functions and data, implement algorithms, create user interfaces, and interface with programs in other languages. Although it specializes in numerical computing, an optional toolbox interfaces with the Maple symbolic engine, making it a full computer algebra system. It is used by more than one million people in industry and academia and runs on most modern operating systems, including Windows, Mac OS, Linux and Unix.

## History

The language was invented by Cleve Moler in the late 1970s, then chairman of the computer science department at the University of New Mexico. He designed it to give his students access to LINPACK and EISPACK without having to learn Fortran. It soon spread to other universities and found a strong audience within the applied mathematics community. Jack Little, an engineer, was exposed to it during a visit Cleve Moler made to Stanford University in 1983. Recognizing its commercial potential, he joined with Cleve Moler and Steve Bangert. They rewrote MATLAB in C and founded The MathWorks in 1984 to continue its development. These rewritten libraries were lovingly known as JACKPAC. MATLAB was first adopted by control design engineers, Jack Little's specialty, but quickly spread to many other domains. It is also used in education, in particular the teaching of linear algebra and numerical analysis.

## Example MATLAB code

This code, excerpted from the function *magic.m*, creates a magic square *M* for odd values of *n*.

[J,I] = meshgrid(1:n);
A = mod(I+J-(n+3)/2,n);
B = mod(I+2*J-2,n);
M = n*A + B + 1;

Note the complete lack of *for* loops. Idiomatic MATLAB programs usually operate on whole arrays at a time. The MESHGRID utility function above creates arrays like these:

I = 1 1 1 J = 1 2 3
2 2 2 1 2 3
3 3 3 1 2 3

Most scalar functions can also be used on arrays, and will apply themselves in parallel to each element. Thus mod(2*J,n) will (scalar) multiply the entire J array with 2, before reducing each element modulo *n*.

## Competition

One of MATLAB's competitors is the symbolic computation program Mathematica. MATLAB is more convenient for numerical analysis and linear algebra, and is frequently used in the engineering community. Mathematica on the other hand has superior symbolic manipulation, making it popular among physicists. Another fundamental difference is that the MATLAB language is similar to common imperative programming languages, while Mathematica uses its own functional language.

There are many other alternatives for numerical computing. GNU Octave, Scilab, and Rlab bear strong resemblance to MATLAB. The article on numerical analysis lists many other possibilities.

## See also

## External links

Last updated: 05-06-2005 14:21:39