Here is the data he collected

Graphical Analysis 1 Physics 227 Lab Introduction to Scientific Analysis of Data using Spreadsheets. Computer spreadsheets are very powerful tools t...
Author: Karen Cameron
2 downloads 0 Views 1MB Size
Graphical Analysis 1

Physics 227 Lab

Introduction to Scientific Analysis of Data using Spreadsheets. Computer spreadsheets are very powerful tools that are widely used in Business, Science, and Engineering to perform calculations and record, present, and analyze data, as well as perform a variety of more sophisticated calculations that can use a number of special functions. One of the virtues of spreadsheets is their relative ease of use compared to programs like Matlab and Mathematica or programming languages like C, or Fortran. In fact, spreadsheets have many of the functions of programming languages as built in functions and can do many of the same things. You can also make your own custom functions that can be called in spreadsheets if you need to, and Microsoft Visual Basic for Excel is a full-fledged programming language (albeit with a bit of a learning curve). We will be using Microsoft Excel for this lab. However other spreadsheet programs are very similar and have much of the same functionality. For example, OpenOffice is a free suite of software programs with Word Processor, Spreadsheet, Presentation (Power Point), Drawing, Math typesetting, and Data Base software. http:/www.openoffice.us.com/openoffice/free-open-office-downloadyahoo.php?pk=845397 The Open Office spreadsheet is called Calc. Don’t worry if you have never used Excel before, we will learn how to use the basic features of it in this lab. You should become fairly proficient in using Excel by the end of the semester since we will use it to analyze and plot the data for almost all of the experiments. Learn how to use Excel yourself. Don’t let your partner be the one who always makes the spreadsheet, you should take turns working on it.

Linear Graphs The basic linear equation y − mx + b is the simplest and most widely used relation to fit data to. Remember that m is the slope and b is the y intercept of the function. x is called the independent variable and y the dependent variable, since y depends on x. The independent variable is the quantity that you directly vary at will in your experiment, like moving a ball from one height to another. The dependent variable is the quantity that is responding to your change, such as the potential energy of a ball that you are moving. When graphing the independent variable is usually put on the horizontal axis, and the dependent variable on the vertical axis. Step 1: Let’s take some data from a lab experiment on the photoelectric effect that we will perform later in the semester. This experiment involves shining a light source on a simple circuit which causes a current to flow in the circuit. The student adjusted the wavelength of the light source, and measured how much voltage it took applied against the current to stop the current from flowing (this is called the Stop voltage, or Vs )

1

Graphical Analysis 1

Physics 227 Lab

Question 1: Next week everything will go into your lab book, but for today open up a word document and answer the questions in there. Be sure you and your partner’s names are at the top as well as the lab number and title. In this experiment what is the independent variable and what is the dependent variable?

Here is the data he collected.

First open an Excel spreadsheet and manually type in the above table. Be sure you know how to add the wavelength symbol, and make sure you include the units. It is good practice to leave a few blank rows at the top of the spreadsheet for information about the spreadsheet, column labels, and column units. Note the information at the top of the given table about who took the data and when, also the information about the equipment. You should get in the habit of doing the same thing for your experiments. After you have typed the data in the columns, make a simple scatter plot of the data. To do this select both columns of data then click the insert tab, and select the scatter plot with no lines showing, as shown on the top of the next page.

2

Graphical Analysis 1

Physics 227 Lab

The graph should look similar to the one shown above. There are several problems with this graph.

3

Graphical Analysis 1

Physics 227 Lab

Step 2: Excel’s biggest user base is business, so default graph formats are mostly setup for that purpose. As a result you have to do a lot of formatting work to get a graph into a proper scientific or engineering format. For all charts you make you should go through the following list. Make sure you know how to do every part of the list (and do them) before moving on to the next part. Most can be adjusted through the green highlighted chart tools section at the top, or by right clicking whatever you want to change and opening its properties. Graph Format: Minimize white space The data should occupy most of the graph window area, rescale your axes to fix this. Chart title In scientific papers this is usually done with a figure caption, but for this lab each graph MUST have a chart title. Axis titles All Axes MUST have a title, and MUST include units if applicable. Delete unnecessary legends For this set there is only one series of data, so having the legend that says ”series 1” in unecessary. If there were multiple data sets to distinguish from this would be nice to leave on. Remove gridlines Major and Minor tick marks inside These are the small marks at each number of the graph, make sure they are shown and in your plot area. Basically you are deleting unnecessary marks, white space, and information. Then you are making sure all necessary information is included so that you can tell what the data is by looking at the graph alone. Question 2: Did you do all of the above? If yes then copy and paste your graph into a word document for printing NEAR THE END OF LAB. When you are finished your graph should look similar to the following. Now note that the data does not appear to be entirely linear when plotted here. There seems to be an increasing slope at the two shortest wavelengths. Without knowing any theory, one typically plots the dependent variable vs. the independent variable. If the data is not a linear relationship then one looks for other functional forms (transformations of the variables that give a more meaningful relationship).

4

Graphical Analysis 1

Physics 227 Lab

Luckily in known cases the theory has often already been developed. The photoelectric effect (what our above data set is for) is described by the following equation, (which earned Einstein the Nobel Prize in physics in 1921) hf = eVs + W (1) or dividing by e and solving for Vs , Vs = (h/e)f − W/e.

(2)

Here h is Planck’s constant, e is the electron charge, W is the work funciton of the surface, Vs the stopping voltage, and f is the frequency of the light.Don’t worry too much about the variable or the theory here yet, we’ll revisit this in a later lab. Now look at equation 2, you should notice that this is in a very familiar form, specifically the linear form y − mx + b Equation 2 shows that if we plot the frequency of the light, not the wavelength as the independent variable and Vs as the dependent variable, we should get a straight line whose slope is the value h/e, and intercept W/e. Since the data taken gives us Vs and λ we need some way to get frequency out of lambda. Luckily there’s a relation between the wavelength of a light wave, and its frequency through the speed of light which is, f = c/λ (3) where c is the speed of light given by c = 2.9979e + 8 m/s.

5

Graphical Analysis 1

Physics 227 Lab

Step 3: Now use a function in excel to add a frequency column to your data. To make a function first type ”=” into a cell, this tells excel to look for an equation instead of just text being entered. So select the top of your third column where you’ll put your first frequency value, type ”=” and then enter the right hand side of equation 3. You will replace λ with your wavelengths by simply selecting the cell that contains the wavelength, in my spreadsheet the location for the first frequency is A7. Now for the speed of light practice using an absolute reference. Type the value into a separate cell elsewhere on the page, I used cell D3. Then in your equation, replace c with the cell D3, but surround the D with dollar signs, leaving you with $D$3. Finally in this equation note that our wavelengths are in nanometers, but the speed of light has meters, you will need to transform from nanometers to meters, review how to do this. Now after you have entered your formula select the cell and at the bottom right you’ll see a little black box, click this and drag downward for your entire column. When you release this it will drag your equation down and change and cell references for you, except for ones that are absolute referenced (If you drag from cell C7 to C8 it will change A7 to A8 in your formula, but leave $D$3 unchanged). Your formula and data sheet should now look similar to below (ignore the top right values for now, and note I put my frequency values in column B).

6

Graphical Analysis 1

Physics 227 Lab

Step 4 As in the picture above, add a linear trendline to your data and display the equation and R2 values on the graph. VERY IMPORTANT: Be sure to format the trendline label with at least 4 significant figures. Use scientific notation format, since if you only pick four decimals, and the number has a large power of 10, it is not going to be correctly shown on the trendline equation and R2 value if not expressed in scientific notation (right click your trendline label and click ”format trendline label” to adjust this). Notice that some information cells have been added to the spreadsheet on the accepted value for h/e, the experimental value (taken from the slope of the trendline equation), and the percent error from the accepted value, 26.8% in this case. There is a problem with this data, as it gives values for h/e that are off by a considerable amount, typically 20-30%, as shown by the comparison with the accepted value on the spreadsheet. When we perform the experiment, we will see the reason for this, having to do with reverse leakage currents, and apply a correction to get better values for h/e and W . Suffice to say the good value for R2 = 0.99699 indicates the data is of high quality and linear to high degree. It indicates that the experimenter likely took good data. Coefficient of Determination: What does the R2 value indicate? In statistics, the coefficient of determination, denoted R2 and pronounced R squared, indicates how well data points fit a line or curve. R2 is a statistic that will give some information about the goodness of fit of a model. It provides a measure of how well observed outcomes are replicated by the model, as the proportion of total variation of outcomes explained by the model. The coefficient of determination ranges from 0 to 1 in most situations you will encounter. An R2 close to one represents a trendline that is almost identical to the data points, meaning that you can use the trendline to accurately predict additional values. The closer the R2 is to one, the better fit to the data, an R2 of exactly 1 indicates that the regression curve perfectly fits the data. However, you need several decimals accuracy of R2 (usually 5 is good) for data that is very accurate, since there is a visual difference in the quality of fit between R2 values of 0.991 and 0.9993 data fits. Also, a fit of 0.9 might sound pretty good, but actually the fit to the data can be rather poor. Often in life sciences and in data sets with several different confounding variables, R2 values might be very low, like 0.5 − 0.7, yet they are considered to be indicative of a trend. For more information on this subject consult this article and the references therein ( http://en.wikipedia.org/wiki/Coefficient_of_determination )

7

Graphical Analysis 1

Physics 227 Lab

Step 5: Add the section shown below to your spreadsheet with random errors added to the stopping voltage values. (the one shown is right underneath the other data and graphs we have done so far). In the spreadsheet below, the formula cell to add a variable random fractional error between plus and minus eps is shown. Be sure to include the eps in your formula with an absolute reference for easy adjustment. Adjust the amplitude of the random noise parameter eps for a few different values between 0 → 0.5 and note how the slope and R2 value changes. Note the graph here has a considerable difference in the slope from the no noise case above to a nominal 15% noise shown in the graph (2.8419 vs. 3.0284 in units of 101 4 Hz), but yet the R2 value is a relatively high 0.980 vs. 0.99699.

Question 3: Basically you are adding an artificial error to your data set, how should increasing the error affect your R2 coefficient? Does what you see in adjusting eps in your spreadsheet agree with your answer? Once you have answered that paste 2 of your graphs with DIFFERENT randomized data into the Word document you have open. Aside from data that have an intrinsic linear dependence, which you have seen in other labs, there is a large variety of data that is clearly nonlinear in the independent variable x but can be 8

Graphical Analysis 1

Physics 227 Lab

transformed to new variables so that one can still obtain a linear relationship between the transformed variables, and then perform a linear least square fit. We just did a very simple case by changing from wavelength to frequency to make the photoelectric data linear. Next week we will approach more complicated cases. What you need to turn in today: You should have a word document with three answered questions and 3 pasted graphs. Be sure to title the document and put yours and your partner’s names at the top, then print this document and hand it in.

9