The goals of this lab are to find a working copy of MATLAB which you can regularly use and start to gain some familiarity with this program. Figuring out where to save your work, send your files, and print out your results is as much a part of the assignment as learning the MATLAB syntax.
See the MATLAB Information page for details.
This first lab is significantly less formal than the labs which will follow. Really, I just want you to figure out how to get MATLAB running and start learning something about how to use it. I would like you to work through the first six lessons in Chapter 2 of Pratap, or at least enough of each lesson so that you understand what is going on. I am not going to check that you have typed in every single command.
First, describe in your log book your MATLAB environment. Include the version, system, location, and anything else which might be out of the ordinary. If you have several places you are planning to use MATLAB, mention that as well.
Now, start working through the lessons in Chapter 2, except for Lesson 7 which you can skip. In particular, I would like you to write some code to solve the following exercises. Note that there are solutions to the exercises on the following page, but try to do this yourself first. For each of these, you should print out your code and your output and tape it into your log book. Get in the habit of including descriptive comments in your code!
Finally, to demonstrate your new MATLAB skills, write a function which will take an array of values as an argument and prints out the mean and standard deviation of these values in a suitable format. Don't use MATLAB's built in mean and std functions, the idea here is to learn how to calculate these by hand. You should compare whether your function gives the same result as the built-in commands, however. Write an M-file script (not a function) which will read in the following file called testdata.txt, produce a histogram of these values, and calls your function to automatically compute the mean and standard deviation. These data are measurements of the height of the Willamette atrium in centimeters made by a recent PHYS 290 class. From this set of data, what is the mean value (including uncertainty) for this height? A histogram can be produced from an array with the hist function. Make sure you understand what this is doing.
The hardest part of this exercise is probably figuring out how to read in text data from a file. Look through your book and use the Matlab Help facility. You should be able to figure this out on your own.
In addition to turning in your lab notebook, I would like you to send your function, script, and data file for the last part (testdata.txt analysis) to me directly by email so I can run it on my own local machine to test your work. Best is to put these three things into a directory, zip them into a single file, and attach them to an email. A tarball will work fine also. Please include a description in your log book of what you have sent me, and which file I should run to perform the analysis. Test that your final script works (beware last-minute changes)!
It probably doesn't make too much sense to work with a partner for this lab, although it is fine to discuss problems with other students or your TA. Each student needs to turn in their own notebook and code demonstrating that they have personally gained some experience working with MATLAB. For future labs, collecting data with a partner will be encouraged, but most of the data analysis will again be done individually.