The best Matlab alternative

Matlab is probably as close as you’ll find these days to an international standard for numerical computations. It seems to be taught at almost all universities in one form or another, is loved by engineers, and contains many thousands of lines of highly optimised code. And as well as the base package, there are lots of toolboxes: add-ons which provide functionality in particular areas: image processing, data acquisition, curve fitting and lots more.

Matlab’s interface, general ease of use, power, and extensibility have made it deservedly popular, and it has spawned a vast publishing industry.

As a teaching tool, though, it suffers from one major defect: it’s very expensive. And the add-on toolboxes add to its cost.

There’s therefore the need of a low-cost – preferably open-source – alternative, which can be used by students as a sort of drop-in replacement for experimentation at home, or on their own laptops.

Here is my list of requirements for such an alternative:

  1. It must install under Windows. This is absolutely necessary for me, at least, since most of my students use Windows. A very few use OSX, and hardly any use Linux.
  2. It must, as far as possible, be identical in use with Matlab. The commands should be the same, and simple scripts and functions should transfer between the two with no effort.
  3. It should have a reasonably nice interface, as similar as possible to Matlab’s own. A basic command line only interface running in a terminal won’t cut it with my students.

Note that I’m personally satisfied with a lot less. I have, for example, no problems with a terminal text-based interface and in fact do most of my own computing from just such. However, I’m interested in making things as easy as possible for my own students, many of whom are not hugely computer-savvy.

The alternatives

There are three alternatives: Octave, Freemat, and Scilab. A little bit about each one.

Octave (more properly GNU Octave) has been around since about 1998, or 1992, depending on how you measure it, and was conceived and initially developed by John Eaton at the University of Wisconsin–Madison to support a course in chemical reactor design. It’s named after one of Eaton’s professors, Octave Levenspiel, who apparently had a genius at “back of envelope” calculations. Anyway, you can read about it on its wikipedia page. As of now, it is up to version 3.2.4, and is a highly mature product, with an emphasis on Matlab compatibility, and supported by an army of users and developers. There are also many add-on packages.

Freemat has been in development since about 2004, mainly by one person, Samit Basu, with help from some others. It seems to have sprung into life very quickly. I can’t find anything online about its history or provenance, but my guess is that it’s a fork or the continuation of some older project. It exists in forms for windows, Linux and MacOS, and has the most Matlab-like interface of all of them. It has a small wikipedia page.

Scilab is in some ways the worthiest alternative to Matlab, in terms of raw power, development (mostly at INRIA, France), and add-on packages. It also has installers for Windows, MacOS and Linux.

There are of course several good comparisons of these software tools, of which “A Comparative Evaluation of Matlab, Octave, Freemat, and Scilab for Research and Teaching” by Neeraj Sharma and Matthias K. Gobbert from the University of Maryland is probably the most far reaching. You can read it here. They don’t make any conclusions as such, but one or two comments are made, such as

“The syntax of Octave and FreeMat is identical to that of Matlab in our tests. However, we found during our tests that FreeMat lacks a number of functions, such as kron for Kronecker products, pcg for the conjugate gradient method, and mesh for three-dimensional plotting. Otherwise, FreeMat is very much compatible with Matlab. Even though Scilab is designed for Matlab users to smoothly utilize the package and has a m-file translator, it often still requires manual conversions.

The tests in this work lead us to conclude that the packages Octave and FreeMat are most compatible with Matlab, since they use the same syntax and have the native capability of running m-files. Among these two packages, Octave is a significantly more mature software and has significantly more functions available for use.”

For numerical solutions of differential equations, the authors state:

“Matlab, Octave, and Scilab have state-of-the-art variable-order, variable-timestep methods for both non-stiff and stiff ODEs available, with Matlab’s implementation being the richest and its stiff solvers being possibly more efficient. FreeMat is clearly significantly weaker than the other packages in that it does not provide a state-of-the-art ODE solver, particularly not for stiff problems.”

Another nice comparison (with lots of screenshots) is at http://www.dedoimedo.com, and is a 2010 discussion on scientific computing. Here’s the conclusion, to save you the trouble of actually opening a web page yourself:

“All three programs have their merits. For Windows users, the simplest choice is FreeMat, while Octave is the most powerful and best run on Linux. Scilab works better on Windows, but it is not fully compatible with Matlab language and requires more effort to master, while leveraging these disadvantages with the fleet of toolboxes and Scicos.

The best thing is, you can use them all together. But if you want to be picky, then I’d recommend you start with FreeMat and Octave and move on to Scilab when you gain enough expertise. “

Some more comments

Freemat seems to be suffering a lack of development, as this chart from ohloh.net shows:

Its current version – 4.0 – while very nice in many ways, has been static now for nearly two years. Interestingly enough, if you enter “help hist” at the Freemat prompt, you are told that this file was “adopted” in Freemat from Octave. This begs the question: how much of Octave has been ported into Freemat? Another problem with Freemat is a seeming low number of users; it simply does not have the large user base of Octave or Scilab.

If compatibility with Matlab was not a concern, then Scilab would be the tool of choice. As well, Scilab comes with Scicos, a dynamic systems modeller similar in style to Matlab’s Simulink. Neither of the other two systems has such functionality. However, Scilab is different enough from Matlab to make conversions between the two (especially of functions and programs) not entirely trivial. There is a conversion program, but like most other conversion programs, it’s a bit hit or miss. Differences between Matlab and Scilab are given here. One thing which always annoyed me in Scilab was that the whos command (which in the other systems gives a list of the user’s variables, with types and sizes), here gives the list of all variables, including built in ones such as %pi and %i.

Octave does not come with any nice interface. However, several third-party interfaces are being produced, of which the most promising for Windows users is GUI Octave. Another fine looking interface is that provided by Xoctave, which at the moment does not seem to be as mature a product as GUI Octave.

Conclusion

Given all the above, my choice is clear: Octave with GUI Octave ticks all the boxes. Almost everything you can do with Matlab can be done in Octave. In fact I use Octave almost exclusively: for various reasons I can’t have Matlab installed on my office computer at work, so all my “Matlab preparation” is in fact done with Octave. This is the system which I’m recommending to my students. Try it yourself! You may be pleasantly surprised.

Note: there are now two follow-ups to this post: The best Matlab alternative (2) and The best Matlab alternative (3).

49 responses to “The best Matlab alternative

  1. I understand that the full Matlab version is very expensive and am a strong proponent and user of open source software. However, the student version of Matlab is only $100. That’s much less than the cost of a textbook. Considering it can be used for more than one class and for more than one semester that seems like a great buy.

  2. You’re quite right about Student Matlab version, & textbook costs. And I may encourage my students in future years to consider this. However, I do like the idea of a good open source alternative!

  3. As for Octave GUI, did you consider QtOctave? It has been developed for more than 5 years. Although QtOctave is mainly focus on Linux platform and it doing a great job under Linux. Recently, there are even Window and Mac port of it. Check it out! http://qtoctave.wordpress.com/

    By the way, QtOctave is discontinued two month ago. I hope someone will continue this work.

  4. Pingback: Casting Out Nines - The Chronicle of Higher Education

  5. Pingback: Weekly Picks « Mathblogging.org — the Blog

  6. How can i write code to check whether a number is divisible by 23 or not on matlab???
    can anyone suggest !!!

  7. Thanks for the post, I was looking for advice on a Matlab alternative, and this really helped!

    @Ravi, use isinteger(Set/23), where ‘Set’ is the set of numbers you are evaluating. It will return true if the number is divisible by 23.

  8. For windows users GUIOctave is the best GUI for gnu octave. it is free but not an open source software.

  9. What do you think about Octave 3.6? It’s installation process in Windows pained me.

  10. Pingback: MATLAB: Are there any free/open source alternatives to Matlab? - Quora

  11. I just had a couple questions about your post…

    First you say

    Scilab is in some ways the worthiest alternative to Matlab, in terms of raw power, development (mostly at INRIA, France), and add-on packages. It also has installers for Windows, MacOS and Linux.

    … then

    “All three programs have their merits. For Windows users, the simplest choice is FreeMat, while ***Octave is the most powerful and best run on Linux. Scilab works better on Windows***, but it is not fully compatible with Matlab language and requires more effort to master, while leveraging these disadvantages with the fleet of toolboxes and Scicos.

    …then

    The best thing is, you can use them all together. But if you want to be picky, then I’d recommend you start with FreeMat and Octave and move on to Scilab when you gain enough expertise. “

    … then

    Conclusion
    Given all the above, my choice is clear: Octave with GUI Octave ticks all the boxes. Almost everything you can do with Matlab can be done in Octave. In fact I use Octave almost exclusively: for various reasons I can’t have Matlab installed on my office computer at work, so all my “Matlab preparation” is in fact done with Octave. This is the system which I’m recommending to my students. Try it yourself! You may be pleasantly surprised.

    ***************************************************************************************

    At first it sounds like your suggesting Scilab is the most powerful… but later you state octave is the most powerful… then you settle on octave as being your preferred choice. Is this because the syntax is easier and more compatible with matlab?

    1. Could you elaborate a little more about a direct comparison between scilab and octave or point me to a post which you have already discussed this. Note I am looking for an alternative to matlab, I have no prior code or scripts written in matlab and don’t need my code to be converted between the two programs. I also have the ability to run linux (debian is my preffered operating system).

    2. does scilab have more sophisticated graphical user interface for it? I have found that i like to work with octave purely because QtOctave is quite a nice GUI system. Are there any open source GUI upgrades for scilab?

    Note that i am not looking for compatibility with matlab. Could you revise your recommendation based on this knowledge. I have a feeling you may suggest scilab is better alternative to matlab in this instance.

    thanks

    • Hmm, you’re right – I see I have been somewhat contradictory. I think that for raw computing power, if compatibility with Matlab is not an issue, you probably can’t go wrong with Scilab. And Scilab does have Xcos (replacement of Scicos), a dynamic systems modeller, similar to the Mathworks Simulink. There’s no GUI as such, but Scilab’s own console links seamlessly with other parts of Scilab, so acts pretty much like Matlab’s command window.

      For my own purposes (mainly digital image processing), the Octave toolbox is far superior to any of Scilab’s offerings (or at least was when I last checked); also Octave integrates nicely with other systems such as sage.

      In the final analysis, there is in fact not much to choose between them, but I find it easier to switch between Matlab and Octave. And since they’re all free, you can play with them all and find which one best suits your needs.

  12. Używałem wszystkie opisywane tu programy.Matlaba jest najlepszy.

  13. Używałem wszystkie opisywane tu programy.Matlaba jest najlepszy.Jako alternatywa octave z gui a następnie free mat.

  14. We have used several GUI options for GNU Octave. However none of the free ones comes with support. Due to this, we have concluded to use Xoctave (www.xoctave.com) which gives a 1 year of support and
    we switched from Matlab to GNU Octave – Xoctave for 6 machines and we have saved more than $15000 (per year). We are satisfied with our decision.

  15. I currently have a Math course that completely requires the students to use MATLAB. Not only do I believe it is ridiculous to make every student pay 100 dollars to use a, in my opinion, 2nd rate programming language due to its dedication to Matrix-related applications. I also find it unethical of Mathworks to charge anything at all for use of “their” software. MATLAB has no affiliation with the creator(s) of Matlab and yet they make millions of dollars off of their software. Every dollar anyone spends goes straight into their pockets. They don’t give you anything but a key to download and install their software. I hope I never get offered a job that uses MATLAB because I will have to refuse in order to find a company that knows something about proper programming.

  16. Any thoughts from others here on a good clone for Mac OSX that can include a signal processing toolkit clone?

    I have used Octave and SciLab for Windows. Overall I liked Octave even without a GUI for its power and emulation of Matlab syntax. It also made excellent quality plots via GNUplot, which is great for professional documents.

    But for OSX, installing Octave has proven to be a nightmare. I’ve tried MacPorts and HomeBrew. For both, I can’t get the signal processing toolkit (from OctaveForge) working. Plotting isn’t working at all in one. And again, the installation is tremendously time intensive with heavy command line manipulation needed.

    Any thoughts regarding OSX? Or an easy way to get Octave + OctaveForge packages working on OSX?

    • Hi Bob DSP,

      I can’t answer your question directly, because I haven’t used any Mac products for years (aside from an iPod Touch I hardly ever use anymore.) I assume you’ve been here:

      http://wiki.octave.org/Octave_for_MacOS_X

      and attempted their suggestions? If none of them work, you may have to ask on a dedicated forum/news group for either Octave, or OSX.

    • I am running SciLab on a MacBook Pro OS X version 10.8.2.
      The install was very easy. I am experienced using matlab on Sun
      workstations. I am struggling a bit on how to do a few things in
      SciLab that were easy in matlab but will figure them out – just takes
      some reading. SciLab appears to have a very nice interface.
      Note – when matlab came out, it reminded me of APL developed by Ken Iverson of IBM. It provided all the capabilities that APL intended
      to provide without requiring the special character set that APL needed. All the matrix capability of matlab and the interpreted operation is what makes matlab and the free software versions very useful.

  17. Pingback: Octave or Scilab - hong-yeon.me

  18. Pingback: The best Matlab alternative (2) « Alasdair's musings

  19. Do you mind if I quote a few of your posts as long as I provide credit and sources back to your
    site? My blog site is in the exact same niche as yours and my visitors would genuinely benefit from a lot of the information you present here.
    Please let me know if this ok with you. Thank
    you!

  20. We provide a free web-based user interface to Octave and scripts can be saved to share. It is primarily intended for students. Please try and let us know if you have suggestions.

    http://hughesbennett.co.uk/Octave

  21. “One thing which always annoyed me in Scilab was that the whos command (which in the other systems gives a list of the user’s variables, with types and sizes), here gives the list of all variables, including built in ones such as %pi and %i.”

    –> try ‘who_user’ in Scilab

  22. $1900 for a professional license can be very unreasonable for those of us who fall through the cracks a little bit. Can’t there be a license for unemployed? Wasn’t completely my fault. Glad to find out there are alternatives in Windows or Ubuntu! – Kevin

  23. When I originally left a comment I seem to have clicked the -Notify me when
    new comments are added- checkbox and from now on each time a comment is added I
    get four emails with the exact same comment. Is there a
    way you are able to remove me from that service?
    Kudos!

  24. This design is wicked! You definitely know how to keep a reader amused.
    Between your wit and your videos, I was almost moved to start my own blog (well, almost.
    ..HaHa!) Wonderful job. I really loved what you had to say,
    and more than that, how you presented it. Too cool!

  25. Everyone wants the best deal when it comes to buying a car.
    Many people are unaware of what is required of them if they are going to
    get that job done. Some people even think they got the best deal when they actually
    are mistaken. Consider the following helpful
    advice when learning more about finding the best deals.

  26. Have you seen people at the checkout with tons of haircut coupons printable and
    hoped that you could be saving huge like them?

    This short article can offer you excellent suggestions
    pertaining to haircut coupons.

  27. Hiya! I know this is kinda off topic nevertheless I’d figured I’d ask.

    Would you be interested in trading links or maybe guest writing
    a blog post or vice-versa? My website addresses a lot of
    the same subjects as yours and I feel we could greatly benefit from each other.
    If you happen to be interested feel free to send me an e-mail.
    I look forward to hearing from you! Superb blog by the way!

  28. Thanks Alasdair, I have been using freemat and was searching online and read the Sharma/Gobbert’s paper myself and was deciding that I have to stick with one of freemat or Octave with a strong inclination towards Octave. I will try out Octave and if like it would uninstall freemat. Who know may be I will keep both

  29. Greetings! This is my first comment here so I just wanted to give a quick shout out and
    tell you I genuinely enjoy reading through your blog posts.
    Can you suggest any other blogs/websites/forums that cover the same topics?
    Thanks for your time!

  30. Nice response in return of this issue with genuine arguments and describing the
    whole thing regarding that.

  31. Oh my goodness! Amazing article dude! Thanks, However I am encountering troubles with your RSS.
    I don’t understand the reason why I cannot subscribe to it. Is there anybody else getting similar RSS problems? Anybody who knows the answer will you kindly respond? Thanx!!

  32. Varivax is the brand name of the game down and I’ve clearly forgotten the name. It is available in a number of herbs that are anti-viral in nature. Is it because of my pregnancy? When making a paste out of oatmeal and one to two weeks so not to endanger people at risk of developing such complications as pneumonia, compared to children. Apa itu right shoulder pain right shoulder pain is also a complication that can result from the right shoulder pain.

  33. It’s appropriate time to make some plans for the long run and it is time to be happy. I’ve learn this post and if I
    may I want to recommend you some interesting things or tips.

    Maybe you could write subsequent articles referring to this article.

    I wish to read more issues approximately it!

  34. Right now it sounds like Movable Type is the best
    blogging platform available right now. (from what I’ve read) Is that what you are using on your blog?

  35. I whole-heartedly agree with your sentiment towards Octave. Working as a lab technician for the meteorology laboratory in the Federal University of Parana, I was once asked to make a Matlab program written in 2002 run in the laboratory’s current Ubuntu machines, under the constraint that the supervisor was unwilling to purchase Matlab licenses. Adapting the programs to Octave was extremely simple, and the software runs perfectly.

  36. Thanks for the helpful comparisons. I thought I had a nice platform picked out with Octave and XOctave, but I’ve discovered a glaring problem with XOctave. If you reinstall the software, or repartition your disk, or otherwise make the slightest change to your XOctave installation it will refuse to start until you re-send your licensing information to the vendor. It then takes them 2 or 3 days to get back to you. The software won’t even start in a limited mode — you just can’t use it. This is very aggravating to the legitimate user who paid for the software. It’s happened to me three times now. You don’t discover that you’re locked out till you start the program (i.e. you need to use it), and I’m not even sure what all the causes of the lockout are. The vendor is quite unresponsive to this.

    So I’m in search of a different Octave GUI, and I would warn anyone reading this away from XOctave till they fix this problem.

  37. Update: I installed GUIOctave and it crashed on my up-to-date Win 7 machine every time I started it. It would connect with Octave fine and then ker-splat. I tried two different versions of Octave, too. The Octave community seems to frown on this software, also, since it’s not open source and doesn’t comply with the spirit of Octave.

    Then I found a reference to WOctave http://sourceforge.net/projects/woctave/ , installed it, and it’s a very nice simple graphical front end for Octave. I’m able to run all my scripts, Gnuplot output is fine, and I haven’t found any problems. I wish I could get my money back for XOctave…

  38. Hi,
    Nice roundup, thanks. I’ve used Scilab on and off on Mac OSX and it works well for my modest requirements. I am interested in Octave on Windows for teaching electronics engineering. There are two ways to install: CygWin and mingw. Any preferences?

  39. Reblogged this on Pink Iguana.

  40. It’s amazing to pay a quick visit this website and reading the views of all mates concerning this article, while I am also keen of
    getting experience.

  41. Pingback: The best Matlab alternative (2) | Alasdair's musings

  42. Pingback: The best Matlab alternative (3) | Alasdair's musings

  43. Success is not final, failure is not fatal: it is the courage to continue that counts.Free Computer Softwares

  44. “The best Matlab alternative | Alasdair’s musings” definitely got myself
    simply addicted on ur web-site! I actuallywill certainly wind up being returning alot more frequently.
    With thanks -Shayne

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s