# Data Analysis Activity Using MATLAB

## Summary

In this activity students will develop a model of air resistance, then perform an experiment using coffee filters, rulers and a stopwatch to test it. They will collect the data, then analyze it and produce a high quality graph that is used to show the results of their experiment. Students will be expected to carefully account for errors, and compute uncertainties in all of their analysis.

## Learning Goals

By the end of this activity, students should be able to:

• design an experiment to test a theory or model.
• keep a laboratory notebook with details of the experiment/results.
• quantitatively account for errors in their experiments.
• use MATLAB to perform a complete data analysis on the data they have collected.
• use MATLAB to produce a "publication quality" graph that can be used to convey the results of the experiment.
• compare their results to other experiments, and try to determine a "correct" value.

## Context for Use

This is an activity I do with students in our Advanced Physics Laboratory course. This is a course typically taken by seniors in their ultimate or penultimate semester, and is usually capped at 12 students. Although the majority of the course involves lab work, the first few weeks of the course are dedicated to developing data analysis skills, and involve some lecture along with activities where students can gain experience with data analysis techniques.

This is one of several activities I have designed to give students practice with these essential analysis skills before they begin to perform more advanced experiments in the laboratory. Students are not expected to (and most likely to not) have any experience with MATLAB. For this reason, part of this activity will be for students learn the basics of using MATLAB for scientific data analysis.

## Description and Teaching Materials

The activity begins with a short lecture on data presentation (i.e. making tables and graphs). I show them some examples and we discuss what makes a graph effective. Although I tell them the goal of this activity is to make a nice graph, there are many other skills they will be practicing along the day.

Students will first work through MATLAB tutorial. This could either be either a packet (or live script) developed by myself, or the MATLAB onramp from Mathworks. After students complete the tutorial we begin developing the a model for air resistance, which we do as a class. As these are advanced students, they generally realize that the force of air resistance should depend on the velocity of the object, and we eventually arrive at a power-law relationship: Fair = C*vn, where C and n are constants. The task is to test this model with an experiment, and determine the power law constant, n. Students, working in groups of two, are given access to flat-bottomed coffee filters, a two-meter measuring stick, a stop watch, and a scale.

Students keep details of their experiment in a notebook. This must include a description of how the experiment tests the model, the data they collected, and the analysis they performed on the data. Before they begin the experiment I have them explain to me what they are going to do, and how it will test the model. I then discuss with them the details, and encourage them to revise their experiment if there appear to be any issues. At the end of the day, students should have produced a well-formatted plot showing the data they along with a complete quantitative analysis of the errors and uncertainties from the experiment.

MATLAB is used to perform the data analysis, do the propagation of error computations, and produce the graph that summarizes their results. Along with details in the notebook. Originally the analysis on this activity was done with GNUplot, which is a free, open source graphing program. However, I have come across some limitations of this program, which has made it particularly frustrating for students to use. Additionally this program is not widely used outside of a small number of academic circles. In looking for a new software package to use for data analysis in the class, I decided that MATLAB was ideal since it is both very powerful, and used not only in academia but in industry as well. This was an opportunity to give students experience with a software package that is widely used.

## Teaching Notes and Tips

• The key to successfully completing this activity is for the students to realize that at terminal velocity the force of air resistance is equal to the force of gravity on the coffee filters. Thus, by changing the number of coffee filters being dropped, you will change the terminal velocity. The terminal velocity can be measured with meter stick and the stop watch, while the force of gravity can be measured by using the scale to determine the mass of a coffee filter. Using the standard "power law analysis" the logarithm of the force of gravity is plotted vs. the logarithm of velocity, which should yield a straight line with a slope equal to the power law constant, n. The goal is to get the students to arrive at this method "on their own" by leading them in that direction without directly giving them the answer.
• It is also important to have students think carefully about sources of error and how to quantify them. The most obvious source of error is timing the fall of the coffee filters to get the velocity. However there are other sources of error such as the distance the coffee filters fall, and the mass measurements. These errors all need to be quantified and included in the analysis.
• Have a discussion with the students about the best way to measure the mass of a single coffee filter. Is it feasible to measure the mass of a single filter? Or is there a better way (i.e., measure the mass of a stack with a known number of filters, then divide to get the mass of a single filter).
• The coffee filters should be handled with care so as to not deform them, and they should be dropped flat side down. Conical filters to not work well for this activity.
• When making the plot, it is easiest to just make a plot of Log(F) vs Log(v). This is a good place to have a discussion with students about what it means to take the log of a quantity with units. This is possible, but it is assumed that you then divide by a quantity of 1 in the units of the argument so that the answer is unitless. Take, for example, the velocity, which can be measured in m/s. Taking the log of v means Log(v m/s)/(1 m/s). The axes in this plot will then have no units. The alternative is to plot the data on a log scale, in which case the axes do have units: force for the vertical axis and velocity for the horizontal axis. If you go down this route you will have to generate x and y data using the fit parameters to put the best fit line on the plot. Example code for both methods is provided below.
• This activity uses a simple model for air resistance that can be found in most introductory physics textbooks. Results should nominally give a power law dependence of n=2. If (or more likely when) students' results deviate from this, then a more complete model can be discussed. Typically this involves breaking down the constant C so that Fair = 0.5*D*rho*A*vn, where rho is the density of air, A is the cross sectional area of the coffee filters and D is the drag coefficient. The drag coefficient can contain additional velocity dependent terms, which may be responsible for results that deviate from a v2 law. Although more complete, an in-depth analysis using this full form of the air resistance adds more complexity into the problem, and the author feels this is beyond the scope of this activity which is mainly about fitting data and making nice graphs that represent the experiment.
Sample data/example script

Sample data and two examples of scripts that work are included with this activity. Here are some notes about the files:

• The sample data is in the file, air_resistance.dat ( 65bytes Oct22 19), which is an ascii text file with tab separated columns. The first column contains the number of coffee filters and time for each drop is in the second column. The uncertainty in time is 0.3 s (typical human reaction time).
• The height for all the drops was 5.10 +/- 0.05 m, and the mass of a single coffee filter was measured to be 1.041 +/- 0.001 mg.
• The coffee filter mass was measured using a digital scale, which had a much higher level of precision than other measurements. Hence the error bars of the force are too small to be seen on the graph. If you want less precision so that the error bars are larger you can use a balance, or some other method with lower precision.
• There are two MATLAB scripts that represent the author's approach to successfully completing this activity (see above discussion about the log plots):

## Assessment

This is one of those activities where its about the journey, and not the destination. As such, I'm not too concerned with the actual results, and more about the process that they used to get the results. The activity itself is graded pass/fail, where I am checking to make sure they did the work, and did it sufficiently. To do this I check the notebooks, and the figure they produce, and give them feedback. This is their chance to practice these skills before it "really counts" in the laboratory portion of the course.

None