Matlab

Exercises for this course require the use of Matlab.

Matlab is available on unagi.cis and on the Sun workstations in Williams 623 (cherry.ling, arch.ling. locust.ling) as /pkg/matlab-5.1/bin/matlab. If you would like to use Matlab on other clients of CIS sun servers, let me know, and it may be possible to arrange it.

Matlab is available in the CETS PC labs, which are located in m62, m70, 142 and 144 Towne. For access to m70, 142 and printing, students need Eniac accounts. They can get eniac accounts based on their enrollment in SEAS or SEAS-crosslisted courses.

A PC version of Matlab has also been installed (in support of Math 420) in three SAS computer labs: 14 seats in DRL 4N16, 11 seats in High Rise South, and 7 seats in VanPelt College House (NOT the library!).

Accessing course-related Matlab objects

Both homework assignments and Matlab material referenced in the lecture notes will require access to some course-specific files. In order to access these files, you need to add the directory where they are found to your Matlab "path".

On unagi and its clients, execute (in Matlab):

path(path,'/mnt/unagi/speech/matlab')

In the CETS labs, execute:

path(path,'f:\cis558')

On unagi and clients, you can avoid having to do this at the start of every session by creating a directory named "matlab" (in your home directory), putting in it a file called startup.m, and putting the same "path" command as above in that file.

Preparing/saving your work

In doing homework, or just in trying things out, you may want to prepare a sequence of matlab commands in a file, so that you can work over time to perfect a sequence of operations, and also leave something to hand in or to come back to later.

One solution is to make all of your work into a sort of a function, namely one called with no arguments. If you use a text editor (such as emacs or notepad) to create a plain text file called "foo.m" in a directory (=folder) that is in your matlab path, then if you invoke "foo" at the matlab prompt, it should execute your code. For instance, if foo.m contains just 3*5, executing "foo" will print out

ans =


    15

If you want to control the display a bit more, say to step through your work or to print out commentary, you can use commands like "echo on", "pause", "format compact", "clc" (clear screen), etc.

For instance, if the following file is stored in foo.m, then executing "foo" in Matlab will clear the screen, print three lines of comment, show us what 3*5 is, pause until we hit a key, clear the screen again, print one line of comment, and show us what 4*6 is:

format compact;
clc;
echo on;
%
% This is an example
%    of an executable Matlab file
%    with commentary.
3*5
pause
clc
% This is the second page
4*6

Another solution would be to put your solutions into any sort of file, located anywhere, and then to use cut and paste to transfer chunks of test to Matlab to test them.

Matlab Help Desk

On-line Matlab manuals and other help information are available at the Mathworks site here. To use it, you'll have to "join", which you can do fairly painlessly, and then type your access code everytime.

Roughly the same stuff (the "Matlab Helpdesk") is available on unagi and its clients here without the trouble of signing in.

A generally web-accessible version without a password is (at least now) available here.

Matlab introductions/tutorials

On the Matlab Help Desk page, the second of the "Matlab Topics" is called Getting Started. This links to a rather detailed tutorial, not all of which you probably want to assimilate at once. I suggest that you work through the beginning of it, and then look things up as needed.

Here are links to a postscript and a .pdf (Adobe Acrobat) version of a Matlab Primer by Kermit Sigmon. It deals with Matlab 4 (rather than the current version, Matlab 5) but little or nothing has changed in the basic areas it deals with.

You may want to try some of the demos, especially the one called intro. Just start MATLAB (by typing matlab at the shell prompt), and then execute the command ``intro''.

Some helpful facts to get you going: