There are many different software packages available. It’s important to understand the different capabilities of each as one software package may be the best tool depending on the task. Here, we introduce Matlab, which stands for MATrix LABoratory. Matlab is cost-effective, easy to learn and blends powerful number crunching capabilities with graphical display. It is an excellent tool for working with large data sets. Other packages that you may wish to consider, include Mathematica, Maple, Fortran, C, C++, or Java. In some cases, even a basic TI calculator or Excel is the appropriate tool.
Matlab has become the industry standard for use in many fields including Mathematics, Bioinformatics, Finance, and Engineering. The basic Matlab package includes the core package and Simulink, a platform for modeling dynamic systems. Matlab can also be enhanced through the addition of “toolboxes” (available from Mathworks) including such topics as Control Systems, Image Processing, Splines and SimBiology.
Command Window:
The command window is where you can perform basic calculations, enter commands, run programs, and view the numeric output.
Command History:
The command history keeps a record of past commands that were entered in the command window. To run a command again from the command history, you can simply double click it. Or, if you want to alter the command before running it, you can click and drag it to the command window, change it and then run it (by hitting Enter).
Directory and Workspace (in tabs):
The directory shows the files in the current directory (which itself is listed at the top of the screen). These files can be run by double clicking, or by clicking and dragging them into the command window. The workspace keeps track of the variables that are created. Double clicking a variable in the workspace opens a spreadsheet where the variable can be altered.
Current Directory:
When you run any program, it is important that your Current Directory is set to the location of your program. You can also run programs in a different directory by setting the “path” to that directory. To keep it simple, we will not explain how to do this here, but refer you to the help files.
Help:
The help capabilities in Matlab are well documented. It does take some time to understand Matlab syntax, but if a user is familar with another programming language, the commands are easy to pick up. Functions in Matlab are also well named, so you can often guess the name of a function that you may need.
It is tedious to type everything into the command window, not to mention trying to fix any errors. We now look at the Editor, where you will write your Matlab script files (basic programs) and function files (user-defined functions). As with many aspects of Matlab, there are usually many ways to perform a task. To start the Editor window, you can either type edit in the command window or you can click on the “new script” button .
The Editor is shown below. In the blue bar at the top of this image, you can see that the file is currently Untitled. The asterisk indicates that the file has not been saved since the last change to the file. Try entering the text exactly as shown.
There are few more key parts to this file. Any text that follows a percent sign (%) is a comment and is colored green. These are ignored when the program is actually run, but are an important part of the documentation of the file. It is crucial that you document your files properly both to remind yourself what parts of the program do and to inform any other users that may work with the program in the future.