Chapter 3

A Short Introduction to MATLAB®

MATLAB® (Matrix Laboratory) is a numerical computing environment and fourth-generation1 programming language. Versions of MATLAB® are available for almost all major computing platforms. The material in this book was produced and tested on a version (R2011_a) running on the Mac OS X environment but has also been tested on a Microsoft Windows environment. In addition to the MATLAB® system itself, Mathworks2 offers sets of Toolboxes, containing MATLAB® functions for solving a number of important types of problems.

The simplest way to execute MATLAB® code is to type it in the Command Window, which is one of the elements of the MATLAB® Desktop. For all but the simplest of tasks, however, it is usually preferable to save a sequence of commands in a text file (with the .m file extension) usually created and edited using the MATLAB® Editor. It is also possible to create functions that extend the commands available and the toolbox presented in this book is in fact a set of functions.

3.1 Matrices

The key to using MATLAB® successfully lies in the user's ability to conceptualise data as square, rectangular, columnar and row matrices. Whereas most programming languages are based on ordinary algebra, whereby a symbol or name is used to represent a single numerical quantity, in MATLAB® every name is assumed to be a matrix and the names can be manipulated via the rules of matrix arithmetic.

In order to illustrate the use of MATLAB® let us consider the ...

Get Computational Colour Science Using MATLAB, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.