# And so it begins: Lab #1 in the MATLAB course

The MATLAB course began in earnest on Monday this week with our first full-length lab activity session. This was the second overall meeting, the first one being some organizational stuff and a lengthy fly-through of the main features of MATLAB. What follows is a breakdown of what we did and how it went, which also serves as an invitation for critique and suggestions in the comments.

First, some context. I intend for this course to be heavily hands-on with an emphasis on self-teaching within reasonable bounds. I laid a ground rule in the first class meeting that any question of the form “How do you do ____ in MATLAB?” was going to be met with the responses “What have you found in the MATLAB help documentation? What have you found via a Google search? What have you found out from your lab partner?” I’m not above giving hints to students in the class, but I insist that they exhaust all efforts of their own first before I come swooping in to the rescue, thereby creating a dependency upon me that makes their future, independent use of MATLAB problematic. So students have to do a considerable amount of individual work to learn basic commands and concepts before they come in to lab. Maybe I’ll blog more about that idea later, but now I want to get on to the activity itself.

First of all, students did this homework assignment in the week before the lab. The main item is to produce a graph of $y = \sin(1/x)$ from x = -1 to x = 12. The theme of the lab this week was plotting, as you’ll see. This homework item forces them to figure out the basic usage of the PLOT command in MATLAB. It also forces them to figure out that you can’t just type 1/x in MATLAB if x is a vector.

The first 10 minutes of class are spent taking a quiz over the basic elements of the homework. Then, the lab activity itself. Here it is: CMP150-Lab1 (PDF, 201Kb). The summary:

1. Reproduce a graph of a somewhat complicated function (related to the one from the homework set) with a bunch of extras added in the graph. Create a JPG and submit it.
2. Create a data set by hand and plot it, and add some extras, including a text annotation. But this time, no pointy-clicky stuff using the Plot Tools window — you have to do it all by hand from the command line and put the commands into an M-file and submit that. (The moral: You need to know how to create a plot both ways, using the pointy-clicky stuff and without using it.)
3. Create a two-item data set by hand and plot it, and make it look pretty. Create a PNG and submit it.
4. Create single plot with 6 subplots arranged in a 2×3 grid. Create a PDF and submit it.

The philosophy here is that plotting stuff is fun, and there is a kind of immediate gratification when you create something visual that will hopefully serve as a source of low-hanging fruit for beginning MATLAB users. So students learning MATLAB should be introduced to the ins and outs of basic function and data visualization before they see much of anything else. And plotting also provides a convenient inroads to talking about M-files and other important MATLAB components.

So, how did it all go? I have to admit it didn’t start well. The homework set was due at 10:30 AM on Monday, and a good portion of the submissions had a timestamp in the neighborhood of 1:30AM Monday. There were several instances of students not reviewing their notes or watching the assigned tutorial videos before starting on the homework, which they did after midnight on the day it was due. So several teams took around 30-40 minutes just to get a basic plot of $A = e^{-0.2t} \sin(2t)$ up on the screen — simply because they didn’t know how to create a vector, use the exp( ) command, or use the plot command, all of which we covered last week and in the homework.

I don’t say this to shame my students. Rather, I think it illustrates some important psychological points that play into teaching MATLAB, or any kind of technical computing topic, at this level:

• Students who are at the entry level of using technical computing software believe that the software will adapt itself to what they are thinking, rather than the harsh reality of the other way around. When students want to plot $e^x$, they should just type it the way they write it. That may be the ideal case, but MATLAB just doesn’t work that way, and that’s a big problem for some people.
• Most people who do any amount of computing will vouch for the importance of being able to surf the help files of a program to figure out what you need to do if you have something to get done. But freshmen in college have mostly never heard of such a thing. They are still making that transition from high school, where (typically) the teacher tells you what you need to know. Asking students to look up a command in a help system and then play around with it before coming into a lab session where they’ll be asked to do more of the same, is asking students to make a HUGE developmental leap. Or at least to begin to make it.
• I’ve said it before, but the notion that today’s students are digitally native is both unfounded and dangerous. My students are not unintelligent, but many of them had no idea what a PNG was or how it was different from a JPG or PDF (this week’s homework asks them to do some research on that topic); many have never seen anything like a command line; a few of them didn’t even know how to attach something to an email to submit it. The so-called and self-appointed ed tech illuminati pushing this digital native idea have simply got to come back to reality so we can teach these ideas and skills rather than assume them.

Anyway, despite the rocky start, we ended well. I softened my stance, just this once, on giving out hints and how-to advice for a couple of things, and the infusion of progress begat more progress, this time by the students themselves. Most people didn’t make it past the second problem but everybody turned in reasonably good work by the deadline this morning. And by the end, teams were getting excited that they had figured some MATLAB out.

I think we can now move forward into next week, which is about working with data files and doing basic statistics, with confidence and with a little more understanding of what this class is all about. Here’s the homework!