Note: If you alredy know Matlab and want to use an alternate system to deliver your m-files to us, you may; The official system will be using your Athena accounts and running the resident Matlab, emacs, and Netscape programs which are available to you. If you decide to use another system (ie. Matlab for dos, Linux, or some other combination) the burden is on you to to make your system work and to deliver problem sets on-time that work with our system.
(The (return) simply means to hit the return key, sometimes labeled `enter'. When we say ``type return'' we really mean, ``Hit the return key'').
When an outline of a box appears hit return again and you should see the File manager appear. Right click on File and pull down to create a new folder. You should see a folder titled NewFolder in the lower window. Pull the mouse arrow to this window and type modclass and hit return. You should see the name of NewFolder change to modclass. Right click again on File and pull down to Quit File Manager. This should put you back at the athena prompt
When a window outline appears, hit return again. A Matlab graphics window will appear and then disappear, this is OK. Eventually, matlab will start and you will see a >> prompt in the Matlab window. You can enter matlab commands directly at the prompt or execute m-file programs.
Click in the emacs window; you should be able to create and save text files.
Note: files must be saved with a .m extension for matlab to recognize and run them.
With both matlab and emacs running you are now ready to start answering the problems in your problem sets. A simple example is illustrated below.
>>load demo1.dat (return)
>>load demo2.dat (return)
Now type demo1 at the matlab prompt; what happens?
>>demo1 (return)
By loading the demo files into matlab, you have created a variable of the same name that is a single column matrix with the values from demo1.dat.
Now type demo1(1,1) at the matlab prompt; what happens?
>>demo(1,1) (return)
By using the index information after the variable name, you can select specific values from a matrix. Note the first value is the row number and the second value is the column number.
Now type plot(demo1,demo2) at the matlab prompt.
>>plot(demo1,demo2) (return)
Note: you should be getting the idea that you have to type return to get matlab to take the command so I will exclude it from here on in.
Now type the following and watch what happens.
>> title('Demoplot')
>> xlabel('demo1')
>> ylabel('demo2')
>> text(10,100,'here is some text')
From this last item, you see that you can put text information right on the plot, suppose you need to be more long-winded? All you need to do is make yor answer a string.
a=('The information in the plot clearly shows the blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah...')
After you type your well thought out answer and make it a string, to get it to display in matlab all you have to do is type a
>>a
Suppose we wanted to put all of the above commands in 1 executable file?
If we type the following in the emacs window:
% This m-file is part of the problem set demo created by T. Kenna
on 8/16/98
% note that lines that begin with % are ignored as program lines
by matlab
%
% Here comes the real program
%
load demo1.dat % loads the first demo file
load demo2.dat % loads the second demo file
demo1(1,1) % prints the first member of demo1
figure(1)
plot(demo1,demo2)
title('Demoplot')
xlabel('demo1')
ylabel('demo2')
text(10,100,'here is some text')
a=('The information in the plot clearly shows the blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah
blah blah blah blah blah blah blah blah blah blah blah blah...')
After you create and save this file as classdemo (make sure you save it in modclass folder), what happens if you now run the file in matlab?
>>classdemo
Now matlab does everything from downloading the data to plotting to making comments and writing longer answers
Suppose you had more than one plot for question one, and you wanted to give me control of the pace of the program. For example, after starting classdemo, I would see the first plot and see your longer answer a. If you put a pause command as the next line, this will suspend the program and give me time to read and make sense of what you have said.
Continuing in emacs with classdemo.m add the following lines:
'hit any key to resume program'
pause % This will suspend the program until you are ready to move
on
figure(2)
plot(sin(demo1),tan(demo2),'*g')
title('The second plot')
xlabel('Sine of demo1')
ylabel('Tangent of demo2')
b=('Plot number 2 shows the extent to which plot number 2 was yada
yada yada')
After saving these changes, run classdemo.m again. Are you getting the picture?
Once you have finished your problem set m-file(s), click on the instructor or teacher in the problem set assignment and it will bring up the netscape mailer. All you have to do is put in a subject line describing what you are handing in and then simply attatch your m-file to it. When I receive it, all I have to do is run your m-file and it should unfold in an orderly fashion.