Introduction

Learning objectives

As you will have found out by now, it is important to produce well-structured and efficient code. This unit contains exercises designed to show you how to do this. It is also important to be able to represent the results of your work in the best possible way. In this unit you will therefore also learn how to construct a simple Graphical User Interface (GUI) for your code and how to produce movies in MATLAB to present your results.

The time you spend typing is a tiny fraction of the time you spend coding. Much of your time will be spent:

  • designing;
  • testing (making sure your code does what it’s meant to do);
  • debugging (fixing problems);
  • refactoring (rewriting elements of the code without changing what they do); or
  • enhancing (improving the code).

The aim of this unit is to show you techniques to improve your code in order to make it more efficient and user friendly.

Reading list

Much of this unit is based on the following three online sources:

The ‘Writing Fast MATLAB Code’ guide will be particularly useful as you begin to write your own code. I advise downloading a copy now to look at as you go throughout the unit. While fairly old now, the techniques described are nonetheless very relevant.