Matlab—A Tool for Doing Numerics
The first time I heard about Matlab was when DOS 3.3 was popular and my dad received a demo version on his PC. I played around with it a bit, but soon lost interest because there was no manual and I did not have any real use for it.
The second encounter was about three years ago when I attended a lecture on numerical mathematics. Some of the exercises the students had to hand in were intended to be solved with Matlab. There was even a handout describing the basic functions of the program. As is usually the case with exercises, numerical homework tends to be very time-consuming, so again I did not spend much time on it. Soon thereafter, I installed Linux on my then new PC.
The third time I came into contact with Matlab was during my diploma thesis. All serious data evaluation in the group where I worked was done using Matlab—not on UNIX, but on a Macintosh.
I asked whether I could bring my until-then “unplugged” Linux box to the lab and network it. I got an IP number and a weekend later the first Linux computer of our group was up and running.
Campus licenses are available for various software and I was quite happy to find Mathematica, Maple and Matlab for Linux. Shortly afterwards, I was running the already-existing Mac-Matlab scripts on my computer.
Matlab is a command-line-driven program specializing in all types of matrix manipulation. Everything in Matlab is expressed using matrices; even a scalar can be thought of as a 1x1 matrix.
The first noncommercial version of Matlab was based on LINPACK and EISPACK routines. Since then, much has changed and Matlab is now one of the fastest packages available for numerical computation.
When Matlab is started in an xterm, a prompt appears after a brief display of the logo in a separate window. Basic editing is possible, though the spoiled Linux user might miss tab completion. (A sophisticated tab-completion feature recognizing file names would be great.)
A nice feature of Matlab is the ability to cluster data into compounds similar to structs in C, but it is not necessary to define them in advance. One simply adds fields to a variable, i.e., data.Temp might be the temperature at which a measurement was taken, and data.B is a vector containing the values of the magnetic field at which the Hall resistivities data.rxy were measured. Adding a string data.date='July-4th-1999' is not a problem, either. Going a step further, it is even possible to use object-oriented features.
For complex tasks involving more than two or three commands, one can write scripts or functions. The difference between them is that scripts are executed as if they were typed at the command prompt, whereas functions use private memory with local and global variables, and of course, can have multiple return values. The syntax loosely follows C and makes scripting relatively straightforward.
It is even possible to implement graphical front ends for your Matlab application with all different kinds of buttons, sliders and levers, as shown in Figure 1.
The interface used in the Linux version is extremely simple compared to the Windows or Macintosh version. No editor is provided for scripting, so the user has to stick to Emacs or some other editor. I personally use XEmacs in Matlab mode with syntax highlighting. The mode was written by Matt Wette and can be found at ftp.alumni.caltech.edu/pub/mwette/matlab.el. As far as I know, there is even a mode for GNU Emacs which makes it possible to run a Matlab session within the Emacs window.
Debugging scripts is not nearly as comfortable as in the Windows or Macintosh environment, where the editor windows have buttons for running the script stepwise. Instead, debugging has to be done by issuing commands for setting breakpoints, etc., on the command line. Mathworks could make big improvements by adding, for example, a window with Step In/Over/Out buttons with a display showing the next command and offering the option of adding breakpoints.
In my opinion, it should be rather straightforward to implement this in Tcl/Tk with the script sending the specific command to the command line. An inspection window for variables would also be a neat feature, one that, to my knowledge, does not even exist on other platforms.
|Natalie Rusk's Scratch Coding Cards (No Starch Press)||Feb 17, 2017|
|Own Your DNS Data||Feb 16, 2017|
|IGEL Universal Desktop Converter||Feb 15, 2017|
|Simple Server Hardening||Feb 14, 2017|
|Server Technology's HDOT Alt-Phase Switched POPS PDU||Feb 13, 2017|
|Bash Shell Script: Building a Better March Madness Bracket||Feb 09, 2017|
- Own Your DNS Data
- Simple Server Hardening
- Teradici's Cloud Access Platform: "Plug & Play" Cloud for the Enterprise
- Understanding Firewalld in Multi-Zone Configurations
- From vs. to + for Microsoft and Linux
- The Weather Outside Is Frightful (Or Is It?)
- Bash Shell Script: Building a Better March Madness Bracket
- Server Technology's HDOT Alt-Phase Switched POPS PDU
- IGEL Universal Desktop Converter
- Natalie Rusk's Scratch Coding Cards (No Starch Press)