MATLAB is a well-known numerical computing environment often used by scientists and engineers to prototype algorithms and simulate complete systems. The MATLAB programming language is quite easy to learn, which makes it attractive for non-computer scientists whose programming experience may be limited. In fact, it was originally designed in the 1970s to give students access to numerical computing libraries without having to learn Fortran, which was (and, in some places, still is) the language of choice for scientific programming.
Given the richness of the infrastructure provided by the MATLAB environment and the wide variety of toolboxes available for it (for example, the Simulink toolbox for simulation), it is no surprise that its use has expanded, sometimes beyond the disciplines you might expect. You might be surprised to learn that MATLAB can be employed to run experiments in cognitive psychology. As they are introduced to the various aspects of MATLAB, cognitive scientists are learning how to create sensory stimuli (such as sounds and images), test subjects, and analyze the results of their experiments using statistical techniques, all within a single powerful tool.
The authors have produced a tutorial-like handbook that might be suitable for lab use in courses where students may have no previous programming experience. It is organized into ten easy-to-read chapters.
The first four chapters deal with basic MATLAB operations, data handling, plotting, and programming. Basic data types are introduced, as well as structures and cells, two of the basic mechanisms provided by MATLAB for creating user-defined types. The commands for reading and writing data to and from files are described, as well as those necessary for printing and saving images when plotting data. Finally, a shallow introduction to programming in MATLAB is also provided, enabling readers to write their own scripts and functions.
The next two chapters deal with basic multimedia processing in MATLAB. In less than 50 pages, readers learn how to experiment with the creation of simple sounds and images, the kinds of sensory stimuli used by cognitive psychologists in their experiments.
Chapter 7, “Data Analysis,” is the most mathematically demanding in the book. It describes how to summarize data using descriptive statistics and how to perform different kinds of statistical tests in MATLAB. Readers should have some background in statistics, since the chapter is basically a tutorial on implementing different statistical techniques in MATLAB. The techniques themselves are not described.
Chapter 8 briefly overviews GUIDE, the MATLAB graphical user interface development environment. Basically, it is a rapid application development tool integrated into the MATLAB environment. In some sense, it is similar to Delphi or C++Builder, but much less powerful and subject to the limitations of the MATLAB programming language. In fact, using it feels almost like a return to C graphical user interface (GUI) programming in the mid-1990s, since it requires passing handles around to keep things working.
Finally, the last 50 pages of the book focus on the Psychophysics toolbox for vision research (www.psychtoolbox.org), originally developed by David Brainard and Denis Pelli in 1997. This toolbox is freely available for both MATLAB and GNU/Octave, an open-source (and mostly compatible) alternative to MATLAB. The Psychtoolbox offers a set of functions for synthesizing auditory and visual stimuli, which can then be used in experiments to test real subjects, whose reaction times can be recorded via mouse or keyboard events.
The book is clearly written in general, although it does not dig deeply into the rationale and details of the topics it addresses. Numerous code snippets are provided, although readers should be watchful. Unfortunately, some of the code snippets in the book are buggy (including the variance computation in pages 83 and 88) and readers might not notice it. Since numerical routines can be prone to error and are hard to debug in interpreted environments such as MATLAB, readers are encouraged to look for existing functions that perform the necessary computations, such as the var function for computing the variance.
This book includes some interesting examples from psychology research, which might also be useful in courses for nonpsychologists. Solved exercises are also valuable for self-learning, as are the suggested readings at the end of each chapter. Each chapter concludes with “A Brick for an Experiment,” which together guide the reader, step by step, through the implementation of a curious experiment in audiovisual perception. In the completed example, two moving objects are seen as bouncing off each other or streaming through each other depending on whether a sound is presented or not when they overlap.
In summary, this book is a pragmatic hands-on tutorial on MATLAB that might be useful to scientists without prior programming skills, including most psychologists and social scientists. More computationally advanced readers might prefer alternative sources of information if they plan to use MATLAB in their work.