# Matlab

*459*pages on

this wiki

*This article contains text copied from Wikipedia under the terms of the GFDL. It needs to be edited to have a Computer vision focus.*

**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.

## HistoryEdit

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 codeEdit

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*.

## MATLAB in Computer VisionEdit

The inherent matrix manipulation abilities of Matlab make it very well suited to computer vision. The core package allows the user to manual manipulate matrices and display images and 3D visualisation plots. There are also a number of additional add-on libraries called “Toolboxes” that are useful such as the Image Processing Toolbox, Wavelet Toolbox, Neural Network Toolbox, and Image Acquisition Toolbox among others.

The image processing toolbox has support for

- Image registration
- Reading and writing image files
- Spatial transformations such as rotation, resizing, and custom transformations
- Linear filters
- Transformations (e.g. Fourier and Radon)
- Morphological operations (e.g. Dilation, Erosion)
- Region base processing
- Colour processing
- Image deblurring

## Competition Edit

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. Python/NumPy/SciPy, GNU Octave, Scilab, and Rlab bear strong resemblance to MATLAB. The article on numerical analysis lists many other possibilities.