MATLAB is a high performance interactive software package for scientific
and engineering computation. MATLAB integrates numerical analysis,
matrix computation, signal processing and graphics in an easy-to-use
environment where problems and solutions are expressed just as they are
written mathematically. To start MATLAB on our system just type
matlab in a terminal window or find the Matlab icon in the applications panel (use the button).
We have various handouts online. Mathworks' own Getting Started with MATLAB is useful. Alternatives are CUED's Getting Started with Matlab (PDF version) and Matlab by Example. Getting to know Matlab is less technical. The Matlab Primer gives an out of date description of facilities. Using Matlab at CUED (PDF version) lists the added local features, and gives answers to many questions commonly asked at CUED. Mathworks' Using MATLAB gives more details on maths, graphics, object-oriented programming etc.
Our 2nd year Introduction to Octave can be used for Matlab.
Toolboxes are libraries of extra routines.
- The Symbolic Math Toolbox gives access to the full Maple library of routines to factorise, integrate, solve etc, symbolically. Type mhelp intro within matlab for details.
- The Statistics Toolbox User's Guide includes a tutorial.
- Also installed is the WaveLab toolbox for investigating Wavelets. Read the introductory handout for details. Type WavePath to get started and see a list of demos.
Typing ver inside Matlab lists the other toolboxes that we're licensed to use. If we don't have something you want, try
Matlab has its own text-only help system (type help from the matlab prompt) and WWW-based documentation (see the online documentation or type doc). There are some video tutorials you can play (see the Demos sections, especially "Desktop Tools and Development Environment"). Use matlabdoc -a to list documentation files available in the alternative (PDF) format. "matlabdoc -a newfeat", for example, will display the 'New Features' document.
The Mathworks site has many resouces too -
- Matlab Answers (rated answers)
- Link Exchange (announcements about resources)
- Blogs (including video blogs)
Some short local articles are now online
- Input/Output - File Input and Formatted Output - Spreadsheets with Matlab - Experimental data with Matlab
- Language Features - Object-orientated programming - Finding Matlab functions - Function handles - Matlab: higher dimensions - Matlab: NaN and Inf - Matlab cells and structs
- Special Topics - Curve fitting - Symbolic Maths Toolbox - Matlab and ODEs - Matlab and 1B dynamics for CUED students - Mex files - Find local min and max values - Matlab graphics with LaTeX
- Optimising - Vectorisation Tricks - Faster Scripts - Matlab for CUED IIB project students, Easter term
- Customising - Matlab's desktop
- Teaching - Matlab, presentations and publishing
Articles elsewhere include
- Techniques for Debugging MATLAB M-files (Mathworks)
- Fixed-Point Modeling in an Ultra Wideband (UWB) Wireless Communication System (Mathworks)
- Calculating Complex Integrals (Mathworks)
- Using MATLAB's meshgrid command and array operators (Mathworks)
- Exporting Figures for Publication (Mathworks)
- Making Pretty Graphs (Mathworks)
- Troubleshooting Common Floating-Point Arithmetic Problems (Mathworks)
- Support Guide to Graphics Rendering and Troubleshooting
- Avoiding Out of Memory Errors (Mathworks)
- Maximizing Code Performance by Optimizing Memory Access (Mathworks)
- GUI Building with Handle Graphics and GUIDE (Mathworks)
- File I/O Guide (Mathworks)
- Curve Fitting Guide (Mathworks)
- Introduction to Object-Oriented Programming in MATLAB
If you have problems, you can try using matlab's debug facility (begin with dbstop). Alternatively, local users can
- look at CUED's Matlab FAQ
- mail Tim Love (tl136)
- look at the University's Matlab Forum
- look at the global newsreader.mathworks.com forum (a list of the newsgroup's Frequently Asked Questions (FAQ) is online).
Some ancient manuals can be borrowed from the operators in the Engineering dept's DPO. Documentation from other universities is available
- Some Control Tutorials from the University of Michigan may be useful. They include animations.
- The University of New Hampshire has online tutorials
SIMULINK is an extension of MATLAB that lets you model a system graphically. It adds to Matlab many features specific to dynamic systems while retaining all of MATLAB's general purpose functionality. See Simulink's documentation for details.
In January 2007 Mathworks identified bugs in R14SP3 Simulink(R) code generation products, which in rare instances generate incorrect code that is not easily detected. These bugs have been fixed in subsequent releases: R2006a, R2006b, or the upcoming R2007a release, so if you used R14SP3 to generate code, upgrade and regenerate.
Matlab can also be used from C++ and fortran as a library of maths and graphics routines. Also C++ and fortran code can be called from within matlab. An Interface Guide is online. Current examples are in /usr/local/apps/matlab/matlabR2007a/extern/examples/ on our Linux servers. Local users using these files on the linux servers should note that some local configuring may be required - see Matlab: configuring mex page.
We have 1 license centrally maintained for Mathworks' compiler that converts MATLAB programs into stand-alone applications (though the royalty-free MATLAB Compiler Runtime (MCR) needs to be installed for the "stand-alone application" to work). Note that MATLAB's matrix-oriented operations are already highly optimized. As a result, the MATLAB Compiler is unlikely to significantly speed up functions that spend most of their time in MATLAB's built-in indexing, math, or graphics functions, or that are heavily vectorized.
See the Running Long Programs documentation before running long jobs. Matlab scripts can often be speeded up considerably with little work - see the Faster Scripts document. The first 2 methods mentioned below have speeded up some CUED programs by a factor of 10 or so.
- Use sparse matrices when you can. They may save you a great deal of space and time. See matlab's sparse command.
- Use matrix operations instead of for loops - i.e. vectorise your code. See the Tricks page and Peter Acklam's MATLAB array manipulation tips and tricks.
- Functions are faster than scripts - they get compiled internally the first time they are run.
- If you know the maximum size that a matrix will be, create it that size initially, rather than letting it grow incrementally.
- Use pack every so often to tidy up memory usage.
Note that some operations aren't speeded up, whereas others are over 3 times faster (the y axis running from 0 to 3.5). To exploit multi-processors more fully (or to use several machines in parallel) you need extra software. Here are some of the alternatives, not all of which are free.
- MatlabMPI (used at CUED. Offers low-level multi-core/processor facilities, and multi-computer facilities if the machines share the same filesystem)
- pMatlab: Parallel Matlab Toolbox (uses MatlabMPI)
- multicore (partly superceded by Matlab 2007a)
- Parallel Computing Toolbox (Mathworks - to use several cores/processors in a more sophisticated way than the default allows)
- Distributed Computing Server (Mathworks - to use several machines)
See Mathworks' Enhancing Multicore System Performance Using Parallel Computing with MATLAB article.
Added facilities include
- August 2014: The default version is Matlab R2014a
- April 2014: Matlab R2014a installed. To run it, type matlabR2014a
- August 2013: The default matlab is release R2013a.
- July 2012: The default matlab is release R2012a.
- September 2010: The default matlab is release R2010a.
- September 2009: The default matlab is release R2009b.
- November 2008: movietogif installed - converts movies to animated GIFs.
- September 2008: The default matlab is release R2008a.
- April 2008: matlabR2008a installed. Default is still the old matlab.
- July 2007: Matlab R2007a installed on the Unix Teaching System.
Our site-license covers the following types of machine within the department - HP, Apple OSX, Compaq (DEC), SUN, Linux RedHat and machines running 32-bit/64-bit versions of Microsoft Windows which are connected to the department's network.
See the On-line Installation of Windows version of MATLAB page for Windows machines.
To activate your newly installed copy, see the Matlab Activation page.
Mail other installation requests to helpdesk.
In 2011 the department joined the university wide TAH (Total Headcount License) scheme for MATLAB. Members of staff, postgraduates and undergraduates can use the TAH license in standalone mode ie not connected to any network in their personal computers (laptops). For more information see the MATLAB Licensing Information page. If you have any queries email helpdesk
See our MATLAB Licensing Information and MATLAB - Frequently Asked Questions on Licensing at CUED for licensing details.
Old versions of Matlab are installed on CUED's central system under /usr/local/apps/matlab/
Purchasing Additional Licences for ToolBoxes
Mail helpdesk for license details.
Students who need MATLAB on desktops/laptops (non-networked) can order it from Bookshops (this includes a book, Simulink and some Symbolic Toolbox functions). See Mathworks' Student Version page for details.
Any additional toolboxes (priced at US$59) can be purchased directly from the American web site using a credit card. These are only for bona fide students.