You can do this lab in Smith Basement Lab at a Sun Ray terminal or in Pearson 101D
By the time you complete this lab, you should be able to:
diary
command to save your work into a file you can submit for grading You may get through this whole assignment in 50 minutes, but many people will finish and submit it later. Do as much as you can during the lab period, but in general you will finish labwork outside of lab.
Use the SunRay help site listed above. If you have login difficulties, check out the login help page FIRST; then ask your TA for help.
Applications
>
Logout
menu item.
Do not
select the "Save Current Setup" choice in the logout
dialog box. Please consult the Troubleshooting section of GNOME Desktop for UD Sun Ray Terminals at the following link:
http://www.udel.edu/topics/os/unix/sunray/aboutGnome.html#troubleshooting
So, from Step 1, you should be logged into a Sun Ray, and looking at the Gnome Desktop.
Next, use the mouse to select the Applications Menu, and then the option Other, and finally MATLAB. Wait.
You'll see the MATLAB splash screen. This should stay on the screen for a few seconds, and then be replaced by the MATLAB desktop, pictured after the splash screen. This is the same thing you saw at the end of lecture on Wednesday.
If you already have Firefox open, skip the rest of this step. On the applications menu (the same one you used to start up MATLAB) you should find a menu item called "Internet", and under that, an item called "Web Browser" (or something like that). Select that option to start up Firefox. At the bottom of your screen, you'll see tabs that you can click on to move back and forth between the web browser and the MATLAB window.
Then click on labs, then on lab00.html.
You should then be looking at a copy of this page in the web browser. If not, ask your TA for assistance.
The following exercises are designed to get you comfortable with the MATLAB environment. For now, we'll do all our work in the Command Window part of the MATLAB environment.
First, let's calculate the value of 4 squared. Type it in and hit "return" (or "enter").
>> 4^2
You should get the following result:
ans =
16
Now, use MATLAB calculate the area of a circle of radius 4. Try typing this into the command window:
>> area = pi * 4^2
You should get the following result:
area = 50.2655 >>
Now try typing the following:
>> x = sin(pi/2);
If you put the semicolon (;
) on the end, then MATLAB will print nothing in response except the symbol >>
, which is called the prompt. The prompt is where you type input into the MATLAB Command Window.
But what you have done is to assign a value to a MATLAB variable called x.
The value of x can be shown by evaluating x on the command line, like this:
>> x
The result should be something like this:
x = 1 >>
Take a minute and play with the command window. "Playing" is a crucial part of learning about computer programs. Your lab is a great time to play because your TA can help you figure out anything you don't understand.
In the command window, type
>> diary lab00.txt
This turns on a record of what you type in MATLAB. Then execute the same expressions you did for step 3, and try a few different expressions
[after executing these expressions turn the diary off by executing:] >> diary offYour text explains the diary command if you need further information. You should now have a files in your account called lab00.txt. In the next step, you will submit this file for grading by your TA.
The following web site describes how to log on to Sakai. Submitting to Sakai will put a "time stamp" on your work so we know when you submitted it, but you will also submit a printed copy for grading.
Note that although you can log on to Sakai from any web browser, in order to submit the work you do in MATLAB, you need to be on one of the SunRays on the UD campus so that you can get at the file lab00.txt
Log onto Sakai (www.udel.edu/sakai) and find CISC106 (if it is not listed, tell your TA)
Follow the instructions for submitting an assignment in Sakai (help -> assignments -> submitting) and submit this as lab00). You should submit one file:
Now print the diary file and staple it together. Make sure your name and section are on the front, and then submit to your TA. Why have both paper and electronic? The electronic is a time stamp and also cannot be lost; the paper version is easier to grade.
You'll probably want to use a SunRay to access MATLAB. SunRay terminals are found in Pearson 101D, but that room is typically in use for various computer labs during the week. You can also find SunRay terminals in the basement of Smith Hall. In lecture, we'll talk about how you can also access MATLAB on "strauss.udel.edu" from any PC or Mac with Internet access. There will still be some features of MATLAB that you'll only be able to do on a SunRay, but most features you'll be able to do from anywhere.
Adapted from labs by Phill Conrad and Terry Harvey.