MATLAB

From ArticleWorld


MATLAB (MATrix LABoratory) is an environment and programming language aimed at numerical computing. It includes a number of powerful functions for performing complex matrix operations, data and function plotting, algorithm implementation, along with support for GUIs and interfacing with other programming languages. The Maple symbolic engine makes MATLAB a veritable computer algebra system, although MathWorks, its producer, only claims it to be aimed numerical programming.

MATLAB was initially written by Cleve Moler in the 1970s, while he was chairman of University of New Mexico's Computer Science department. In 1984, he rewrote MATLAB completely, along with Steve Bangert and Jack Little, and founded MathWorks. At the moment, MATLAB is used by more than 1 million people (a remarkable number for a product aimed at those with very vast mathematical knowledge).

The programming language

MATLAB uses a programming language called M-Code. The language is a dynamic-typed, mainly value-oriented language. It supports scalar and N-dimensional array variables and others.

The following example illustrates how to plot the function sin(2x), with x ranging from 0 to 2 x pi.

>> x = 0:pi/30:2*pi;
>> y = sin(2*x);             
>> plot(x,y);                
>> xlabel('x (radians)'); 
>> ylabel('sine function')
>> title('sin(2*x)');

Note that the '>>' at the beginning of each line comes are not part of the program prompts displayed by the M-Code interpreter when running in the interactive mode.

Criticism

Although a very popular and critically acclaimed piece of software, MATLAB has received some significant criticism.

The major problem is that of vendor lock-in. MATLAB is completely owned by MathWorks. The standards, the software and the libraries are all managed by MathWorks, therefore leaving little freedom to its users. Many MATLAB users are already seeking alternatives.

The other problem of MATLAB is its M-Code language, which has a strange syntax, both for a FORTRAN-trained engineer and for a C programmer. The syntax itself is rather confusing. The most annoying confusion is that of procedures with lookup tables. An expression like:

y = f(x)

can mean "y takes the value of the procedure f executed with the argument x", but also "y takes the value of the x-th element in the matrix called f". MATLAB will correctly interpret this, but the programmer must review the declaration of y and f in order to distinguish between the two cases.

The other program is the fact that MATLAB doesn't have support for many features needed in simulation applications. Although some are available in the Simulink package, this adds some extra cost to the already quite expensive license.

M-Code also lacks support for references, making it difficult to implement some data structures like linked lists. It also makes using the object-oriented facilities more difficult.