My ME 352 class provided me with the opportunity to examine the suitability of an open source alternative to MATLAB. For those who don't know, MATLAB is a very powerful tool for data analysis and programming. The purpose of this project was to determine the forces in a machine as it moved through it's operation. I have published my results (which are partially incorrect for the dynamic friction cases) at my Purdue website. The source code for the project is there as well (released under the GNU GPL), if you would like to reproduce these tests or improve upon the code.
There are a few things in my life that I hold to be axioms. Open source is better than proprietary, and free is better than for pay. Purdue, fortunately for me, makes it very easy to be an engineering student. MATLAB usually costs about $100 for a very bare bones version, but Purdue has a license that allows each mechanical engineering student to install the full version of the software on their personal computer for free. However, this still requires the use of Windows, which I hate. I have been wondering if it is possible to go through mechanical engineering at Purdue while using Linux. Some coursework requires LabVIEW and a program called EES, so MATLAB isn't the only obstacle but it is an important first step, since a majority of my work is done in MATLAB. I will note that unlike most software there is a direct Linux port of MATLAB, but again Purdue does not offer that to students.
The open source alternative to MATLAB is GNU Octave. It is a free software package that claims to be mostly compatible with MATLAB. Since I have already written those 1200+ lines of code, I decided to test it out with Octave and see how compatible it was. I tested both the Linux and Windows versions of Octave, though I found both experiences to be similar. Since the program required for the project is pretty simple (just a few loops and some matrix operations) I was fully expecting the results to match, and they did. The plots generated by MATLAB exactly matched the plots generated by Octave. There wasn't even so much as a warning or any errors. I do have a few issues.
First, the user interface of the plots. When you plot something in MATLAB, it looks like this;
As you can see, you get options to zoom, print, save, pan, rotate, etc. MATLAB makes it very easy to manipulate the plot once it has been generated. Further, it is easy to then save this plot in a variety of formats and then put into a report or onto a website. In fact, the entire website where my results are published came from a menu option in the MATLAB Editor. The plots generated by Octave look like this;
As you can see, there are no options. If you right click you can zoom in to a box on the figure, but beyond that the options are seriously limited. In fact, the only way I found to alter the plot or to save it is to code those commands into the script that generates the plot and rerun the script. It shouldn't be that hard to simply save a plot. I believe this has to do with the use of a separate program called gnuplot that takes care of the plot generation. Perhaps in future versions, these programs will be better integrated to allow for more features and a more useful interface for plots generated by Octave.
The next few issues are pretty minor compared to the plotting. Octave runs in a terminal window, whereas MATLAB has a user environment that provides quite a bit of useful information, such as the names of stored variables and the contents of the working directory. Finally, Octave was noticeably slower than MATLAB in executing the code. I suspect that this is largely due to the plotting part of the code, since the plot windows came up at a much slower rate than the MATLAB figures. Again, this may be more of an issue with gnuplot rather than Octave specifically. Finally, Octave would occasionally freeze if I would close all of the figure windows and run the script again. That is an issue that I never had with MATLAB.
In the end, I'd say that I absolutely could have accomplished this project using Octave rather than MATLAB. It may have been slightly more difficult to handle the plots at first, but I think with practice it would have become second nature to me as MATLAB has. The problems with Octave were not technical, but rather just usability. I'll definitely be following the Octave project in the future.
0 comments:
Post a Comment