What use is it to learn Matlab

Numerical math software

Matlab and Octave

What is MATLAB

MATLAB (from the English MATrix LABoratory) is a software package for numerical calculations. It is characterized by the pronounced efficiency in the execution of operations of linear algebra, which in turn are the basis for most numerical calculation methods. Other features are

  • the open structure: practically every function it contains, with the exception of the basic operations of linear algebra, can be modified by the user;
  • the thematic grouping of functions that can be purchased as required;
  • the direct coupling to a graphic programming surface for simulations (Simulink);
  • the possibility of embedding C or Fortran programmed routines.

Start Matlab

You can start Matlab on any Linux computer at the Physics Institute. To do this, type in the shell

matlab &

The & at the end of the line is of course optional. After introducing Unix, you now know what the use is.

After Matlab starts, your window should look something like this

You can now type in your commands and invoices in the input window. Analogous to entering commands in the shell. Tap to check that Matlab is up to the task.

You can then exit Matlab with or again.

Start Matlab without GUI

The graphical user interface of Matlab offers many useful functions. But it also needs some system resources. This is particularly annoying if you want to work via an ssh connection (more on this later). The graphical user interface also makes starting Matlab slow. For simple things, it is therefore usually worth starting Matlab without a GUI:

matlab -nodesktop

Matlab starts interactively in the shell. So don't start this job running in the background.


The core of Matlab is proprietary software. To use Matlab you therefore need a license from Mathworks. UZH has a "floating network" license for 157 users. This license is valid for the entire network of the university and not for individual computers. At the university, 157 users can work with Matlab at the same time. No matter which computer you are sitting at.

You can find more information about the Matlab licenses on the IT services page.

In addition to Matlab, the free alternative is also installed on the Linux computers at the Physics Institute. Octave is largely compatible with Matlab and as free software there are no restrictions on how you can use the Octave. Start Octave with


and check that 1 + 1 = 2 also applies in Octave.

As you can see there is no GUI installed for Octave. But that shouldn't stop you from using Octave. You can do this course with both Matlab and Octave. Things that only work with one of the two programs are marked accordingly.

Like a calculator

You can use Matlab and Octave instead of a calculator for simple tasks. At the end of this block, try a few simple calculations. Here are a few suggestions.


  1. 21 + 21
  2. 14 * 3
  3. 756 / 18
  4. 50 - 8
  5. sqrt (1764)
  6. 6^2 + 6

You can enter the last task in two ways. Either you type everything in one line, or you first calculate 6 ^ 2 and then use it to continue calculating with the result.

Show solution

21 + 21 14 * 3 756/18 50 - 8 sqrt (1764) 6 ^ 2 + 6% or 6 ^ 2 ans + 6

Simple variables

You can of course also use variables in your calculations:

a = 10 b = 6 3 * a + 2 * b

Predefined symbols

The most important mathematical constants are defined automatically:

> i% better 1i ans = 0 + 1i> pi ans = 3.1416> e% only octave ans = 2.7183

When defining variables, you should avoid overwriting these symbols. Therefore, if you mean the complex unit, you should always use it. a variable cannot begin with a number, so this expression is still unique even if you have defined a variable.