Matlab


MATLAB (matrix laboratory) is a numerical computing environment and fourth-generation programming language. Developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, Java, and Fortran. Although MATLAB is intended primarily for numerical computing, an optional toolbox uses the MuPAD symbolic engine, allowing access to symbolic computing capabilities. An additional package, Simulink, adds graphical multi-domain simulation and Model-Based Design for dynamic and embedded systems.

Taken from Wikipedia - http://en.wikipedia.org/wiki/Matlab

Contents

Starting Matlab

Start Matlab from the G-Bar menu under Mathematics > Matlab or directly in a terminal by typing:

matlab &

The & lets you continue using the terminal, although you have just started a program.

How to use Matlab

When opening matlab you will see a bunch of windows. There is both a

Command window

The Command window is where you can write commands to matlab. E.g. asking matlab to open files, do simple calculationen etc. This window is not for large simulations since the commands cannot be stored and retrieved later. For this you want the Editor window. This is found by clicking File -> New -> Script.

Editor window

The Editor window can be used to create or modify M-files. In M-files you can create scripts to do different types of simulations with iterations and so on.

Workspace window

Current Directory window

Command window

Troubleshooting Matlab

Matlab will not start, error message: unable to initialize com.mathworks.mwswing.MJStartup

Remove the file classpath.txt in your home directory, and start Matlab again.

Matlab will not start, only the splash screen shows, and then nothing

Remove the file classpath.txt in your home directory, and start Matlab again

I get a screen full of (Java) error messages when trying to open Matlab or the Matlab editor.

Check if you have a file called classpath.txt in your home directory, and remove this file before you start Matlab.

I use surf to plot a 3d surface, but the plot is empty

This is a bug in Matlab, and appears only if you use the new version for the first time, and still have the information bar ("Note new toolbar buttons ...") active. Close this bar by clicking on the 'x' to the right, and the figure should appear.

I can not get the | (pipe) character.

Due to an error in programs with a Java GUI (like Matlab) it is difficult to make a | (pipe). You can get a | by pressing Shift, Alt Graph and the button with <, > and \.

I would like to save the Matlab search path, but Matlab can not save the path

You should make a folder called matlab in your home directory - it is important that the folder is named matlab in lower-case letters. If you save the search path to this folder Matlab will use this search path in all further Matlab sessions.

I want to use Matlab at home, but I'm a poor student.

Check out the programs Octave (can only do numeric computations) and Scilab. These are free (As in GNU) alternatives that are almost as good as Matlab. You can also use Thinlinc or run Matlab through an SSH connection.

Which toolboxes are available?

You can see the list of available toolboxes (and versions) by running

ver

in a Matlab session.