Scientific computation

Updated: May 11, 2007

If you're an engineer, you have probably heard of - and maybe even used - Matlab. Matlab is a very powerful numerical computing environment and programming language. It is very intuitive and will suit the free mind of a scientist. It offers a broad range of tools for manipulation of data, plots and images, writing of functions and algorithms, and even creation of user interfaces. However, a major downside is a very steep price.

At work, most of us are not concerned with the price of Matlab. Someone else pays. But at home, you will not so readily reach into the pocket and pay for a license. Luckily, there is a handy number of free alternatives available. This article is dedicated to Matlab alternatives, with a short overview of general functionality, the ease of use and useful links to sources and tutorials.

A few words of clarification: This article is not a comprehensive guide to all possible numerical analysis programs. Nor is it a guide to computer algebra systems - these will be discussed in a separate article in the future. This articles aims specifically at m-code compatible software, which allows Matlab-savvy engineers to make an instant switch and continue enjoying the power of numerical computation without going bankrupt.

For the curious, bold and beautiful, you can use the List of numerical computation software to learn more about available programs, both free-of-charge and commercial ones. Back on topic, Matlab alternatives.

FreeMat

Homepage

Quoted from the website, FreeMat is a free environment for rapid engineering, scientific prototyping and data processing. Compared to Matlab, the Command Window is a bit sparse. The menu is simple if practical. However, if you disregard the aesthetic minutes, FreeMat offers a clean, functional working environment.

It must be said that FreeMat 3.0 is a vast improvement over the previous version. The history of executed commands can be cleared from within the program, the editor offers a better control of multiple tabs and the graphs are now fitted with shortcut buttons for most common operations. The program is also equipped with an updater checker.

Freemat Command Window

The application is solid, robust and light. The installation takes only 25MB. This commodity is somewhat negated by the fact that most complex functions included with Matlab toolboxes are not readily available. Nevertheless, they can be easily found and downloaded off the Internet.

FreeMat fully recognizes the M-code. The integration is seamless. Matlab functions and scripts will run without any problems, provided the infrastructure of needed functions is present.

FreeMat edtiro

Making beautiful, impressive graphs - supported by extensive calculations - is extremely easy and completely transparent for Matlab users. Best demonstrations are always 3D graphs, with colorized topography and exponential whatnots.

Freemat graph

The same applies for images, which can also be treated with different colormaps for enhanced effects. The above snippet of code is actually translated into the below images when executed.

Freemat image 1

Freemat image 2

FreeMat comes with solid documentation. The manuals are well written and easy to follow. Finally, another bit of Matlab that is missing is the GUI building. But this will be implemented in the future releases of FreeMat. But for home users, FreeMat is a very good choice and an excellent compromise between functionality and cost.

Octave

Homepage

GNU Octave is a command line numerical computation software with very high compatibility with Matlab. Compared to FreeMat or Scilab, it has a much poorer interface (no IDE). Another downside is that Octave has been optimized for Intel processors and may cause problems when run on AMD machines. I have not encountered this problem, but the potential future users should take this into consideration.

The Windows installation takes ~ 141MB. The Linux installation is smaller (~ 60MB), but the plot engine (gnuplot) needs to be installed separately (~ 2.5MB). Regardless, both packages come with a broad range of functions, allowing quick integration for Matlab veterans.

Octave console

Graphs are similar to FreeMat's, with relatively limited tweakability. The layout must be applied using the command line. Below, I have recreated the example shown at Wikipedia, showing both the code and the resulting sombrero graph.

Octave graph

Although the IDE is not officially supported or currently maintained, Octave users can try the Octave Workshop. The Workshop offers a very Matlab-like user environment and is currently available for Windows and FC4. Documentation is solid, although available only online for free; a printed version can be purchased. Although the least friendly, Octave is most Matlab-like tool, in terms of code.

Scilab

Homepage

Scilab is another highly useful numerical computation package, available free of charge. Nevertheless, commercial redistribution and modification is not permitted.

The major difference between Scilab and the other two programs presented here is that Scilab uses its own high-level programming language, somewhat similar to C. However, it supports Matlab-Scilab conversion, with a high degree of compatibility.

Scilab installation (~ 135MB) also includes Scicos block diagram modeler/simulator, which is very similar to Matlab Simulink and National Instruments LabVIEW. Scicos allows for graphical modeling of dynamic systems with emphasis on the flow rather than code.

Like the other two programs, Scilab features a simple and straightforward console. It has a rich menu, which allows a high level of customization and quick access to useful tools, including the Editor and Scicos. Like FreeMat, you will have to set the working directory every time you start the program.

Scilab console

The Editor is quite powerful and is rich in options. In a way, it surpasses the Matlab Editor. It allows the user to build dependency trees, time the execution of functions and fully customize the layout. Below is an example of a typical Scilab code:

Scilab Editor

Graphs are also very impressive. A number of readily available tools allows the user to take full advantage of his work, including copying of graphs to clipboard or printing to Postscript.

Scilab graph

Scicos

Scicos is extremely useful for simulation of systems, provided efficient modeling. For people who have never dabbled into graphical programming, the concept may sound strange and revolting. Nevertheless, Scicos is very easy to master.

After only 5 minutes of reading, using the sample Chapter 7: Getting Started from Modeling and Simulation in Scilab/Scicos book, I managed to reproduce one of the examples. Users of either Simulink or LabVIEW will find the transition extremely easy.

Scilab Scicos

Visual customization is also available - it is very important when working with complex diagrams.

Scilab Scicos example

Like FreeMat and Octave, Scilab works well both in Windows and Linux. There are no glitches and the executions is fast. For power users, Scilab is probably the best choice, also because of the inclusion of Scicos. Nevertheless, the two other programs offer a more seamless integration.

Links

FreeMat Manual - PDF form (direct link)

GNU Octave Repository

Octave Documentation

Introduction to Scilab

Introduction to Scilab User's Guide - PDF download (the guide is in English!)

Scilab Image Processing Toolbox

Scicos > Examples

Scicos help

Conclusion

To help you digest all the facts, I have compiled a small comparison table, most of which contains a personal touch, based on my experience.

Parameters FreeMat Octave Scicos
Win/Linux Y/Y Y/Y Y/Y
Installation ~20 MB ~70-140 MB ~130 MB
M-code compatibility 8.5 9 7
Editor 7 7 N/A
Graphs 9 6 9
Ease of use 9 8 7
Documentation 9 7 9

What should you use? All three of them.

Cheers.