Science:Math Department Teaching Resources/MATLAB

From UBC Wiki

The following MATLAB resources page is aimed at both instructors and students who plan to use MATLAB or similar software packages in their courses.

The content of this page was compiled by a group of (current and past) members of the Math department: Warren Code, Richard Froese, and Costanza Piccolo. If you would like to list additional resources on this page, please contact Costanza Piccolo (costanza at math dot ubc dot ca).

Where to find MATLAB in the Math department

  • Undergraduate Labs: MATLAB is installed on all of the computers in the department's computer labs, LSK 121 and LSK 310.
  • Purchase student version: The Student Version of MATLAB will do many of the things the full (expensive) version can do. It can be downloaded from MathWorks for US$99 (requires validation of student status for full activation), or purchased at the UBC bookstore for a slightly higher price. For more information on the MATLAB student version see the MathWorks FAQ page.

Octave and other alternatives to MATLAB

Octave is a free, open-source MATLAB clone that has seen many years of development. It shares many features with MATLAB, such as the use of matrices as the fundamental data type and the idea of user-defined functions to extend computational capability. Most of the Octave syntax is compatible with MATLAB, which means most of your m-files will run in both environments. However, some differences exist. Here is an extensive list of differences between MATLAB and Octave developed by The Institute for Computational Engineering and Sciences at the University of Texas at Austin.

Because of its MATLAB compatibility, Octave has become a viable alternative to the proprietary package in the education setting (see this 2010 comparative evaluation of MATLAB, Octave, FreeMat, and SciLab for research and teaching).

Other free, MATLAB-like numerical computational packages are:

  • FreeMat is another free, open source MATLAB clone with the most similar interface to MATLAB, but is somewhat limited in the functions it supports and is not under especially active development.
  • SciLab is a free MATLAB-like program developed by French researchers.

How to install Octave

  • Here are some instructions on how to install Octave developed by instructors and students of Math 307.
  • This is the official Octave Wiki page with installation instructions and other information.

Learning to Program in MATLAB/Octave

The number of MATLAB tutorials available online is endless. Below are just a few of these resources aimed at novice users of MATLAB/Octave and beginner programmers. Note that because of the compatibility of Octave and MATLAB, most of the information in the resources listed below are suitable for both MATLAB and Octave users.

For more experienced programmers interested in comparing the two programming languages, here is an extensive list of differences between MATLAB and Octave.

MATLAB resources

  • Video tutorials: over 40 screencasts developed by Robert Talbert, a professor at Grand Valley State University. They cover the basics of MATLAB programming and plotting useful for coursework. Most of the commands showed in these videos will work in Octave as well.
  • Printable tutorials from the Southern Illinois University. They include basic tutorials, as well as materials specific to their linear algebra, numerical analysis, linear programming courses. For more succinct tutorials on basic programming, check out the list of Octave resources.

More extensive collections of videos and tutorials are :

  • The official MATLAB manual developed by MathWorks, the developer of MATLAB. The "Getting Started" link at the top of the left hand frame takes you to a list of basic tutorials, while short videos and more advanced examples are available in the "Examples" section.

Octave resources

  • A list of short printable tutorials, based on the longer document linked above. Each document contains a list of practice exercises (you may safely substitute "MATLAB" where it says "Octave" in these documents, except for the program setup information, which is of course different):
  1. Getting Started (Octave-specific on first page)
  2. Building and manipulating vectors and matrices
  3. Performing matrix operations
  4. Implementing for loops
  5. Basic Plotting

FAQs

  • Instructors and TAs of Math 307 have developed a page with useful Octave tips, that include both tips of general use (compatible with MATLAB), and information specific to Math 307 coursework.


Advanced Reference

This more extensive link site by Kevin Murphy at UBC CS include a number of resources for more advanced topics (object-oriented programming, style guide, connecting to R) as well as several command tips.

The wikibook below is more useful as a reference if you already know somewhat what you are doing and what you are looking for. The MathWorks does have some tutorials, but are probably best used when you want complete information about a MATLAB function (all input and output variables; similar to the "help" command but with more detail).

Other Links

These are other online resources you might find useful.

  • Wiki Book on MATLAB Programming, contains many of the basics and a list of things that are different between MATLAB and Octave. It is possible to get a printable version of the wiki.
  • MathWorks MATLAB site; this is the developer of MATLAB and includes a complete function reference, as well as some introductory tutorials on the software.