Tutorial 2: Using Excel in Data Analysis



Similar documents
Scientific Graphing in Excel 2010

Microsoft Excel Tutorial

Microsoft Excel Tutorial

Sample Table. Columns. Column 1 Column 2 Column 3 Row 1 Cell 1 Cell 2 Cell 3 Row 2 Cell 4 Cell 5 Cell 6 Row 3 Cell 7 Cell 8 Cell 9.

0 Introduction to Data Analysis Using an Excel Spreadsheet

Plots, Curve-Fitting, and Data Modeling in Microsoft Excel

Using Microsoft Excel to Plot and Analyze Kinetic Data

How to make a line graph using Excel 2007

Dealing with Data in Excel 2010

Summary of important mathematical operations and formulas (from first tutorial):

Below is a very brief tutorial on the basic capabilities of Excel. Refer to the Excel help files for more information.

This activity will show you how to draw graphs of algebraic functions in Excel.

Spreadsheets and Laboratory Data Analysis: Excel 2003 Version (Excel 2007 is only slightly different)

Using Excel for descriptive statistics

Excel Tutorial. Bio 150B Excel Tutorial 1

A Guide to Using Excel in Physics Lab

Excel -- Creating Charts

EXCEL Tutorial: How to use EXCEL for Graphs and Calculations.

Excel Math Project for 8th Grade Identifying Patterns

Excel 2003 A Beginners Guide

MS Excel. Handout: Level 2. elearning Department. Copyright 2016 CMS e-learning Department. All Rights Reserved. Page 1 of 11

Excel 2003 Tutorial I

SECTION 2-1: OVERVIEW SECTION 2-2: FREQUENCY DISTRIBUTIONS

Calibration and Linear Regression Analysis: A Self-Guided Tutorial

Task Force on Technology / EXCEL

INTRODUCTION TO EXCEL

Generating ABI PRISM 7700 Standard Curve Plots in a Spreadsheet Program

Excel 2007 A Beginners Guide

Creating Charts in Microsoft Excel A supplement to Chapter 5 of Quantitative Approaches in Business Studies

Getting Started with Excel Table of Contents

Intro to Excel spreadsheets

Information Literacy Program

Using Excel for Handling, Graphing, and Analyzing Scientific Data:

Microsoft Excel 2010 Tutorial

Experiment 1A: Excel Graphing Exercise

Google Docs Basics Website:

Appendix 2.1 Tabular and Graphical Methods Using Excel

Excel Guide for Finite Mathematics and Applied Calculus

Drawing a histogram using Excel

Formatting Text in Microsoft Word

Interactive Excel Spreadsheets:

Appendix C. Vernier Tutorial

Excel Basics By Tom Peters & Laura Spielman

STC: Descriptive Statistics in Excel Running Descriptive and Correlational Analysis in Excel 2013

Curve Fitting in Microsoft Excel By William Lee

Microsoft Excel 2010 Charts and Graphs

Electrical Resonance

GUIDELINES FOR PREPARING POSTERS USING POWERPOINT PRESENTATION SOFTWARE

Advanced Microsoft Excel 2010

Using Excel (Microsoft Office 2007 Version) for Graphical Analysis of Data

Charting LibQUAL+(TM) Data. Jeff Stark Training & Development Services Texas A&M University Libraries Texas A&M University

This activity will guide you to create formulas and use some of the built-in math functions in EXCEL.

To launch the Microsoft Excel program, locate the Microsoft Excel icon, and double click.

Figure 1. An embedded chart on a worksheet.

Basic Excel Handbook

MS Word 2007 practical notes

Microsoft Excel 2013: Charts June 2014

FREE FALL. Introduction. Reference Young and Freedman, University Physics, 12 th Edition: Chapter 2, section 2.5

USING EXCEL ON THE COMPUTER TO FIND THE MEAN AND STANDARD DEVIATION AND TO DO LINEAR REGRESSION ANALYSIS AND GRAPHING TABLE OF CONTENTS

Excel 2003: Ringtones Task

CREATING EXCEL PIVOT TABLES AND PIVOT CHARTS FOR LIBRARY QUESTIONNAIRE RESULTS

MARS STUDENT IMAGING PROJECT

Plotting Data with Microsoft Excel

CONSTRUCTING SINGLE-SUBJECT REVERSAL DESIGN GRAPHS USING MICROSOFT WORD : A COMPREHENSIVE TUTORIAL

PA Payroll Exercise for Intermediate Excel

Stress-Strain Data with EXCEL The Tensile Test Download the Data About Using EXCEL

PERFORMING REGRESSION ANALYSIS USING MICROSOFT EXCEL

KaleidaGraph Quick Start Guide

Excel Pivot Tables. Blue Pecan Computer Training Ltd - Onsite Training Provider :: :: info@bluepecan.co.

Working with Spreadsheets

Computer Training Centre University College Cork. Excel 2013 Level 1

Chapter 4 Creating Charts and Graphs

Adding Comments in Microsoft Excel 2003

Excel What you will do:

Excel 2007 Basic knowledge

Microsoft Excel Basics

Excel Using Pivot Tables

Excel 2007: Basics Learning Guide

In this example, Mrs. Smith is looking to create graphs that represent the ethnic diversity of the 24 students in her 4 th grade class.

Guide To Creating Academic Posters Using Microsoft PowerPoint 2010

How To Run Statistical Tests in Excel

Absorbance Spectrophotometry: Analysis of FD&C Red Food Dye #40 Calibration Curve Procedure

Spreadsheet - Introduction

Data representation and analysis in Excel

Microsoft Excel 2010 Part 3: Advanced Excel

Basic Microsoft Excel 2007

2. Creating Bar Graphs with Excel 2007

Excel Using Pivot Tables

Create a Poster Using Publisher

Excel 2007 Tutorials - Video File Attributes

Using Excel to find Perimeter, Area & Volume

Microsoft Access 2010 Overview of Basics

Quick Reference Guide

Terminal Four (T4) Site Manager

SPSS Workbook 1 Data Entry : Questionnaire Data

3 What s New in Excel 2007

Using Microsoft Word. Working With Objects

Working with the new enudge responsive styles

Excel basics. Before you begin. What you'll learn. Requirements. Estimated time to complete:

What is a piper plot?

Transcription:

Tutorial 2: Using Excel in Data Analysis This tutorial guide addresses several issues particularly relevant in the context of the level 1 Physics lab sessions at Durham: organising your work sheet neatly, using Microsoft Excel for manipulating and analysing sets of numerical results, and using Microsoft Excel for plotting data to a standard suitable for a lab report. The example we will look at is based on our second circuits experiment ( Circuits 2: Using an Oscilloscope ), which level 1 students normally do either in week 4 or week 5 of the Michaelmas Term. However, no prior knowledge of this experiment is assumed. Specifically, the data used in the example were obtained through measurements on the same circuit and using the same techniques as in Circuits 2; however, these measurements do not form part of the various tasks students doing that experiment are invited to pass through in the course of that experiment. The experimental set up is sketched in Figure 1: a simple circuit comprising a resistor R and a capacitor C connected in series is driven by a generator producing an oscillating voltage VG ( t ). A voltmeter (an oscilloscope in the experiment) measures the potential dropped across the resistor, V ( t ). The voltage applied to the circuit by the generator can be R represented by a sine function of constant amplitude V G0 and constant period T, namely V ( t) V sin(2 t / T). As is explained in the script of Circuit 2, one finds that the voltage G G0 across the resistor is also a sine function, which oscillates with the same period as V () t but with a different amplitude, V R0, and a different phase: VR( t) VR0 sin(2 t / T ). The phase shift is readily measured with the oscilloscope. Theory predicts that this phase shifts is related to the resistance of the resistor, R, to the capacitance of the capacitor, C, and to the period of oscillation, T, by the equation T tan. (1) 2 RC G Figure 1: The circuit used in the experiment.

Thus plotting tan against T should produce a straight line of slope 1/ (2 RC), from where the value of the product RC could be obtained. (The internal resistance of the oscilloscope measuring VR ( t), or more precisely its input impedance, should be taken into account, but for simplicity we will ignore this detail here.) Measurements of the phase shift were made at 10 different values of the period T ranging from about 100 to about 1000 microsecond (µs). The results are given in Figure 2. While T is expressed in microseconds, and the quantity α δ specified in the cells D6 to D15 are expressed in degrees. The latter is the experimental uncertainty, or experimental error, on the measured values of : for instance, a measured value of 79.5 deg with an error of 0.5 deg means that the actual value of the phase shift is expected to be somewhere between (79.5 + 0.5) deg and (79.5-0.5) deg. (Durham Physics students are referred to the Error Analysis lectures for more information about this matter.) The experimental error on the measured values of the period is too small to be significant here. It is not specified. What we will do in the course of this tutorial is (1) to prepare an Excel spreadsheet similar to that shown in Figure 2; (2) to use Excel to calculate the tangent of the experimental values of and to calculate the uncertainty on the resulting values of tan given the uncertainty on the values of ; (3) to use Excel to make a graph of tan vs. T ; and (4) to use Excel to calculate the slope of the straight line fitting the data best and the uncertainty on this slope. This tutorial assumes that you already have a basic knowledge of Excel, in particular in respect of using functions and formulas and using the fill handle. We recommend that you pass through the first tutorial guide before this one if you are not yet confident on these matters. 1. Organising your worksheet Begin by preparing a worksheet formatted similarly to that shown in Figure 2 and containing the same data. To this end, consider the following: Start Excel with a blank worksheet. Save the workbook under a suitable name, so that later on it can be saved every now and then by clicking on the icon. For the sake of this exercise, start by writing a title in big letters, e.g., as in Figure 2, Second Excel Tutorial in bold 16-point fonts. Use the Font menu for changing your fonts from the default. You ll notice that the height of the row will increase to adapt to the larger size of 16-point fonts and that the text will seamlessly extend beyond the right-hand border of the cell you started from. In the example, the content of the cell B2 is Second Excel Tutorial and the cells C2 and D2 are actually empty.

Figure 2: The experimental data, neatly presented. In applications of Excel in the first year Physics labs it is not really necessary to write a title at the top of the worksheet. However, writing a title is good practice and might be essential if you produce many worksheets. Likewise, in other contexts you may need to identify your worksheet by specifying a descriptive name on its tabs at the bottom of the window: double click on the tab name (e.g., Sheet1, the default name of the first worksheet of an Excel workbook) and replace it by what you want. Next, prepare the headings of your table of results (row 5 in the example). It is a poor idea to write masses of numbers without identifying what they represent by proper headings, as sooner or later you will lose track of what is what. Don t forget to specify the physical units in the headings. The units are critical information! For us, the headings are T (μs), δ (deg) and α δ (deg). Writing the Greek letters and the subscript δ will oblige you to some gymnastics and to finding your way through the relevant menus. See our web page on symbols and fonts in Excel for guidance; the url is http://labs.physics.dur.ac.uk/skills/skills/formatting/symbols.php.

To correct a typo, or more generally to edit the content of a cell, click on the cell to make its actual content appear in the formula bar and edit what the latter displays. Press <enter> to finish or the <Esc> key to escape without correction. Whereas in the example the headings fit in the normal width of a cell, this will often not be the case in practice see, e.g., Figure 3. A quick way to widen a column is to position the cursor on the line separating two column headings at the very top of the sheet the cursor will show as a symbol rather than the usual open cross and, pressing the left button, resize the column as desired. A finer control on the width of a column can be achieved by right-clicking on the column heading and selecting Column Width... in the window which will then pop up. The height of the cells can be controlled similarly. Once the headings of your table of results are ready, enter the data column by column. Don t forget to save your work every now and then! Figure 3: A more fanciful way of presenting data in a worksheet, illustrating the resizing of column widths and the use of a colour background, of bold face fonts and of borders in formatting cells. There is really no need to prepare worksheets that you only use for your personal work to this level of detail.

Figure 4: The Format Cells menu. As an exercise, try to re-position the contents of a group of cells inside the cells. Highlight the group of cells with the left button, then right-click and select Format Cells... in the pop-up window which will then appear. This should give you the Format Cells window shown in Figure 4. (If this window only provides a menu for changing fonts, close it, click on an empty cell, and then right-click on the cell containing the heading and try again.) You can reposition the contents of the cells by using the various options offered in the Alignment menu. In the example, the alignment is simply Right (Indent) in the horizontal direction. Very many different possibilities are offered by this menu and the other menus accessible through the Format Cells window. We won t explore them all in this tutorial. The only important point to remember is that the alignment of the content of a cell can be changed at will, as well as virtually any other details of how cells look like including how the numbers are represented (see, e.g., Figure 3). Figure 2 is probably more representative than Figure 3 of the clear and simple worksheets you will want to prepare in the course of a lab session. (However, note the sensible use of plain words in the headings of Figure 3 in replacement of a complex expression involving a subscript.) Keep in mind that time in the labs is limited and that you will need to complete your Excel work quickly. For this reason, it is certainly useful to prepare your worksheets in advance of the sessions.

Should you want to restructure your tables of results or move them around the worksheet, consider the following: o You can delete or insert individual cells or groups of cells and delete or insert entire rows or columns. (Right-click on the relevant cell and select Delete... or Insert... in the pop-up window.) Excel will automatically update the references to the cells affected, throughout the workbook. o You can cut the content of an entire group of cells and paste it elsewhere on the page. Excel will automatically update the references to the cells affected, too. o You can copy the content of an entire group of cells onto the clipboard and past it elsewhere on the page. There are several options for pasting e.g., you can simply duplicate the numerical values, duplicate the formulas, or create links to the original cells. The appropriate option can be chosen from the menu accessible through the icon at the top left of the window. 2. Calculating with Excel Having tabulated the data in Excel, you now need to calculate the tangent of the phase shifts. (Recall that you want to plot tan against the period.) You also need to calculate the uncertainty on tan given the uncertainty on. Create the tan column. Start with the heading. Then write the formula producing tan for the first row of results, taking care to convert the phase shifts from degrees to radians. Assuming that the value of is in cell C6, as in Figure 2, the appropriate formula is =TAN(C6*PI()/180). The PI function, PI(), returns the value of to 15-digit accuracy. Complete the operation for the first cell, then copy the formula to the following lines with the fill handle. When done, your worksheet should be similar to the example shown in Figure 5. Don t pay too much attention to the number of the decimal places displayed in the cells containing tan : you need these results and the corresponding uncertainties only for plotting tan and for calculating the slope of the line of best fit through the data. Now, calculate the error (or uncertainty) on tan. As noted above, if the error on is, then all one can say about the actual value of tan is that it is a number between tan( ) and tan( ). The error on tan is thus two-fold: there is an error tan( ) tan in the positive direction and an error tan( ) tan in the negative direction. Assuming that for the first row of data the value of is in cell C6, the value of is in cell D6 and the value of tan is in cell F6, then the values of these two errors can be computed from the formula =ABS(TAN((C6+D6)*PI()/180)-F6) and

=ABS(TAN((C6-D6)*PI()/180)-F6). Again, prepare the corresponding headings, calculate these quantities for the first row of data, and apply the formula to the rest of the table with the fill handle. The end result should look like Figure 6. Figure 5: The worksheet with the values of tan added. Figure 6: The worksheet with the values of tan and their uncertainties added.

3. Plotting data with Excel Having prepared the results you want to plot, you can now create a rough graph and then improve this graph step by step. Create a simple scatter plot of tan against T. All the necessary instructions are given at http://labs.physics.dur.ac.uk/skills/skills/creatingagraph.php, the Creating a Graph page of the online Physics Laboratory Guide. This page can also be found from the top page of the site, http://labs.physics.dur.ac.uk/general/welcome.php, under Skills > General Skills > Excel Skills. The result will probably look like the example shown in Figure 7. The graph title, tangent of phase shifts in the example, is a mere copy of the name of the data series plotted (as set by the user when creating the plot) which is added automatically by Excel. This title can be removed or edited at a later stage. Please note that it is not possible to use Greek letters, subscripts or superscripts in the name of a data series. Axis labels must still be added to the graph you obtained in this first step. Go to http://labs.physics.dur.ac.uk/skills/skills/formattingagraph.php, the Formatting a Graph page, and from there to the Formatting Axes, Axis Titles and Tick Labels page. How to add axis titles is explained half way through the latter. Add an appropriate title both to the horizontal axis and to the vertical axis of your graph. Do not forget to specify the units, that s important information. You can use Greek letters, subscripts and superscripts as required as already mentioned, how to do this is explained at http://labs.physics.dur.ac.uk/skills/skills/formatting/symbols.php. For an example, see Figure 8, next page. Figure 7: A rough graph of tan against T.

The next step is to add the vertical error bars to each data point, i.e., vertical bars indicating the range of possible values of tan given the uncertainty on. For guidance, go to the Adding Error Bars page, e.g., from the Formatting a Graph page (http://labs.physics.dur.ac.uk/skills/skills/formattingagraph.php). Horizontal error bars can also be shown in figures; however, in the present case, the uncertainty on the period is so small that the error bars would be too small to be seen. Then add a linear trendline and display the equation in the graph. That s explained in the Adding a Trendline page. Don t force the trendline through the origin. Your graph should now look like that shown in Figure 9. Figure 8: The same graph as in Figure 7, now with axis titles. Figure 9: The same graph as in Figure 8, now with vertical error bars and a trendline.

At this stage, the graph contains all the essential elements and is suitable to be used, e.g., in a lab book. However, it is not of sufficiently good quality for a lab report or a publication. We will now improve it and make it consistent with the Department s style manual on the presentation of figures in lab reports. This will involve (1) removing the title; (2) removing the legend; (3) removing the gridlines; (4) removing the equation of the trendline; (5) resizing the graph; (6) changing the range of the axes and adding tick marks for their major and minor divisions; (7) writing the axis titles in normal fonts rather than in boldface (which is the default); and (8) reducing the size of the markers. The finished product is shown in Figure 10. 1. Removing the title: See the Graph Title page. (Like the other web pages mentioned here, this page can be accessed either directly or through the Formatting a Graph page.) Graphs look better without a title. Moreover, a graph shown in a lab report or a publication is normally accompanied by a figure caption stating what the graph shows. 2. Removing the legend: See the Legend page. Legends use space and can often be replaced by appropriate explanations in the figure caption. 3. Removing the gridlines: See the Gridlines and Background page. Graphs usually look better without gridlines. 4. Removing the equation of the trendline: See the Adding a Trendline page. Graphs look better without this information. In lab reports or publications, the slope and intercept of the line of best fit are normally given in the body of the text. Figure 10: The graph of Figure 9 reformatted.

5. Resizing the graph: See the Resizing and Repositioning a Graph page. The graphs produced in Excel are normally too wide to fit into the prescribed width of a column of a lab report without resizing. 6. Changing the axes: See the Formatting Axes, Axis Titles and Tick Labels page. The horizontal axis of the graph shown in Figure 9 extends too far past the last data point. Major and minor tick marks help the eye. (The latter are shorter than the former and have no tick labels.) It does not matter whether the tick marks point inwards or outwards; however, be consistent. 7. Changing the fonts for the axis titles: See the Formatting Axes, Axis Titles and Tick Labels page for this, too. 8. Changing the markers: See the Markers and Lines Styles page. The markers are slightly too large in Figure 9 and the graph would look better if they were reduced in size. As an exercise, try replacing the blue diamonds by red circles, too. 4. Least square fitting with Excel The trendline shown in Figure 9 is obtained automatically by Excel using the method of least squares, which is covered in the Error Analysis lectures forming part of the Discovery Skills module. The equation of the trendline gives both the slope and the y-axis intercept of the line of best fit, however without any estimate of the uncertainty on these two parameters. These uncertainties, as well as the slope and the intercept themselves, are calculated by the LINEST function of Excel. Figure 11: The output of LINEST (cells B19, C19, B20 and C20).

To finish, use LINEST to obtain the slope and the y-axis intercept of the line of best fit through the data as well as the uncertainty on the slope and the uncertainty on the intercept. How to use LINEST is explained in the How to use LINEST web page, which can be accessed through the Excel Skills tab or directly at the url http://labs.physics.dur.ac.uk/skills/skills/linest.php. Having passed through the necessary steps, you will obtain something like Figure 11. Note that you do not need to plot your data for using LINEST. In this example, cells B19, C19, B20 and C20 contain the results returned by LINEST (the slope and the intercept on the first line and the uncertainties on these quantities on the second line). Given these results, and rounding the constants, we can say that the equation of the line of best fit is 3 3 y 5.78 10 0.08 10 x (0.01 0.04), (2) which means that the slope of this line is likely to be between 0.00570 and 0.00586 and the y-intercept between -0.05 and 0.03 in the units in which the x and y variables are expressed. In our case, the x variable is the period of oscillation of the voltage expressed in microseconds, and the y variable is the tangent of the phase shift, which has no physical dimensions. Hence, referring to Equation (1) on page 1, we can conclude that the experimental results are compatible with the relation between T and predicted by theory, and that 1 3 1 3 1 (5.78 0.08) 10 (5.78 0.08) 10 s. (3) 2 RC s