A Free MATLAB Alternative Called Octave

Jai Sachith Paul


Matrix Laboratory (MATLAB) is an all-time favourite tool for electronics engineers working on data interpretation and analysis. There are a lot of reasons that help justify its position—the ease of use, flexibility, documentation and add-ons in the form of tool boxes, among others. But for beginners, enthusiasts and academicians, MATLAB is not always a smart choice. The software along with toolboxes is too costly for them to purchase.

In the search for an effective alternative for MATLAB, we cannot compromise on certain features. First feature is obviously compatibility with MATLAB. If at one point of time, the user wants to switch to MATLAB, he or she should not be forced to re-write the entire code. Second, all computations in the tool should be based on matrices as in MATLAB. Also, the user should be able to create functions in the program. We can add a lot more to this list. In this article we are introducing GNU Octave, a smart open source tool that has all the features that enable it to be a close alternative to MATLAB.

What is GNU Octave
GNU Octave is a high-level programming tool for complex numerical computations. The interactive command line interface (CLI) provides an excellent mechanism for solving linear and non-linear problems numerically. The latest version 3.8.2 is equipped with a graphical user interface (GUI) along with the traditional CLI.

Octave makes use of an interpreter for compiling and executing Octave instructions at run-time. It can create, save or print plots, graphs and charts with the help of gnuplot and Grace software. The tool provides extensive graphics capabilities for data visualisation and manipulation.

The software is written in C++ using C++ standard library. It is available under the GNU general-public licence and can be used, shared and modified free of cost.

Octave now incorporates GUI
Until recently, the main blame on Octave software was that it did not provide the user with a GUI. The argument the company gave was, if you do not have a pocket calculator, you will be really strong at mathematics. Similarly, if you do not have a GUI, you will learn the language better. But the users were not quite happy with such an answer. Octave has finally come up with a workable GUI from version 3.8.0 onwards.

Archimedes: A Free Monte Carlo Simulator for Semiconductor Device Simulations
GNU Octave

Since the GUI is not polished, the graphical interface is not default and the user has to invoke GUI with force-GUI option. Developers are working on the pain areas of the present graphical interface of the software, and will soon come up with another version 4.0.x, with default GUI.

How Octave is different from MATLAB
Let us see how some features in Octave are different from those in MATLAB.

No compiler. Octave does not have a compiler, and hence we cannot convert Octave code into binary for additional speed or distribution.

No just-in-time (JIT) compiler. The JIT compiler in MATLAB increases the speed of for-loops in MATLAB to almost native performance with certain restrictions. Octave does not have a JIT, and hence it might be somewhat slower in such cases. In order to resolve this, vectorise your code as much as possible.

Nested functions. In MATLAB, nested functions have access to the parent function’s scope. Octave does not have this provision.

Defining features in the command line. We can directly write code on the command line for defining the features in Octave.

Commenting statements with # instead of %. The main advantage of having # instead of % at the start of comment line is that # is also a comment character for unix script files. Any file that starts with a string with # will be treated as an Octave script and be executed by Octave.

Strings de-limited by double quotes. The double quote (”) may be used to de-limit strings, in addition to the single quote (’). Also, double-quoted strings include backslash (\) interpretation (as in C, C++ and Perl), while single-quoted strings are un-interpreted.

On SIGLENT X series oscilloscopes Sequence and History mode

Line continuation by backslash. We can continue the lines with a backslash (\) or by using three dots (…).

Function handles, variable argument lists and class definition. There are some limitations in the function handles and variable argument lists in the LHS of an expression. MATLAB classdef object-oriented programming is not yet supported, though work is underway in a branch of the development tree.

Check out the link (http://wiki.octave.org/FAQ) for more differences.

How Octave is different from its competing tools
There has been a lot of research around the world to find out the best alternative tool to MATLAB. FreeMat, Scilab, R and Spyder are some of the popular tools in competition with Octave, to be the best alternative to MATLAB.

Michael Dunn, in one of his blogs titled A Look at Octave vs Scilab, points out that unlike Octave, the syntax of Scilab is quite different from MATLAB. He mentions that the development environment of Scilab is far better than Octave’s. Scilab uses a syntax-aware editor, variable-watch window, interactive terminal, help system and file browser, while Octave uses a terminal interface.

Some users prefer R to Octave because they feel that the data collection, manipulation and analysis capabilities of R are comparable to MATLAB. R can run on Windows, Linux and even Raspberry Pi.

In a research paper on free alternative numerical-computational packages, Matthew W. Brewster points out that both FreeMat and Scilab exhibited some incompatibility with MATLAB and some performance problems in their tests.

Neeraj Sharma and Matthias K. Gobbert, in their research paper titled A Comparative Evaluation of MATLAB, Octave, FreeMat and Scilab for Research and Teaching, find that all packages gave identical numerical results, though Scilab exhibited a limitation in the size of the linear system it could solve in the complex test problem, and FreeMat was hampered by the lack of a conjugate gradient function. The available graphical functions differ in functionality but give equivalent plots, though FreeMat has limited three-dimensional graphics capabilities at present. GNU Octave is the most compatible with MATLAB due to its numerical abilities and similarity of syntax. Another reason to consider Octave is that free parallel-computing extensions are available that are known to work with this package, conclude these researchers.

Multiple Design-and-Simulation Tools in One: Fedora Electronic Lab

What users think about Octave
Users, especially beginners, feel that Octave is an incredibly good tool. In their opinion, it even outplays MATLAB in a Linux environment.

“It never ceases to amaze me that developers write such incredible software and put it out there for free. With this software you can plot sigmoid functions and calculate the transpose of any matrix easily. It is essentially a free version of MATLAB. So, I cannot imagine any business not utilising this priceless software. I am deeply grateful to Octave developers because it means that I can watch a linear algebra video, actually test it and make it work on my computer. The complexity of maths that Octave can handle is amazing. And, all of this for free. Thank you just does not seem to mean enough,” says a user on apps.ubundu.com

A user writes in mathworks.com, “The language is almost identical to basic MATLAB. The discriminating difference is that Octave is open source and free. For my robotics-modelling applications, it is more than adequate. I will likely stop spending money on MATLAB, especially if the Octave organisation develops a basic Simulink-like capability.”

A very useful tool
From the above discussions, we can easily conclude that Octave is an excellent alternative to MATLAB for complex numerical computations. It outplays most of its competent open source software in its usability and performance. The graphical interface, which is a recently added functionality, makes this tool more user-friendly.

Download Latest version of the software: click here

The author worked at EFY till recently


Please enter your comment!
Please enter your name here