Introduction to Computer Programming with MATLAB


The aims of this short course are to introduce the elements and practicalities of computer programming through the MATLAB mathematical computing environment.


Familiarity with using Windows applications, and with the use of a scientific calculator. No previous programming experience is required.


At the end of the course students should be confident about using MATLAB in their own project work, and should feel more prepared to tackle other procedural languages for computing, such as C++ or Visual Basic.

Text books

If you have access to a computer at home, you are recommended to buy a copy of  "The student edition of MATLAB" version for Windows.  The newest version is release 14, but release 13 would be just as good for this course.

The student edition contains a complete MATLAB programming environment and costs about 45.  It comes with an introductory guide. There are also a large number of MATLAB books available, one that is recommended is "Essential MATLAB for scientists and engineers" by Brian D. Hahn, Arnold, 2001, ISBN 0-7506524-0-3.


The student edition of MATLAB may be missing the Signal Processing toolbox files needed for lectures 8, 9 and 10. Replacements for the missing functions can be downloaded as a zip file. Unpack the contents of this file into a DSP direcory in your MATLAB installation, then add the DSP directory to the search path (under File/Set Path).


There is a free MATLAB simulator called Octave available at, however installation of this on Windows requires some computer skills.  Also not all of the MATLAB functionality we will use on the course is available in Octave.

Lab Resources

We will equip the computers in Room G5 with MATLAB. There should usually be at least one machine available for student use at any time of day. Students are recommended to store their program files on the central server, so that they will not be tied to a specific machine.

Web Resources

A 35 page MATLAB primer by Kermit Sigmon can be downloaded from the course web site. A collection of online resources can be found at: The MATLAB home page (from the manufacturers) is at:


1.        Introduction to Programming

1.1.            Components of a computer

1.2.            Working with numbers

1.3.            Machine code

1.4.            Software hierarchy

2.        Programming Environment

2.1.            MATLAB Windows

2.2.            A First Program

2.3.            Expressions, Constants

2.4.            Variables and assignment statement

2.5.            Arrays

3.        Graph Plots

3.1.            Basic plotting

3.2.            Built in functions

3.3.            Generating waveforms

3.4.            Sound replay, load and save

4.        Procedures and Functions

4.1.            Arguments and return values

4.2.            M-files

4.3.            Formatted console input-output

4.4.            String handling

5.        Control Statements

5.1.            Conditional statements: If, Else, Elseif

5.2.            Repetition statements: While, For

6.        Manipulating Text

6.1.            Writing to a text file

6.2.            Reading from a text file

6.3.            Randomising and sorting a list

6.4.            Searching a list

7.        GUI Interface

7.1.            Attaching buttons to actions

7.2.            Getting Input

7.3.            Setting Output

8.        Discrete Linear Systems

8.1.            Characterisation of linear systems

8.2.            Finite Impulse Response filters

8.3.            Infinite Impulse Response filters

8.4.            Frequency response

9.        Spectral Analysis

9.1.            Filterbank analysis

9.2.            Fourier analysis

9.3.            Spectrograms

9.4.            Filterbank synthesis

10.    Speech Signal Analysis

10.1.        Fundamental frequency estimation frequency domain

10.2.        Fundamental frequency estimation time domain

10.3.        Formant frequency estimation


Extra lecture: Program Development


Students will be asked to produce a computer program to specification. The aim will be to demonstrate an ability to transform a problem into a design, and a design into an operational program. Assessment will be based on the design and implementation.


Lectures and Practical Classes: Mondays 1400-1600 Wolfson House.

Coursework Set: End of autumn term.

Coursework Due in: After reading week, spring term