Saturday, April 20, 2024

A Free MATLAB Alternative Called Octave

- Advertisement -

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.

- Advertisement -

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.

A4A_GNU
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.

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.

SHARE YOUR THOUGHTS & COMMENTS

Unique DIY Projects

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components

Calculators