Документ взят из кэша поисковой машины. Адрес оригинального документа : http://www.mso.anu.edu.au/pfrancis/labskills/datahandling/UsingExcel.pdf
Дата изменения: Wed Jan 23 05:35:39 2013
Дата индексирования: Fri Feb 28 05:07:31 2014
Кодировка:

Поисковые слова: m 11
Plotting Data with Excel
For small amounts of data, a spreadsheet like Excel is a good way to plot and analyse data (we'll cover analysing larger data sets later). Unfortunately, the exact procedure is different for different versions of Excel (e.g. PC and Mac Excel, different versions of Office etc). These notes cover Office 2010 for PCs (which is what you will be using in the labs) and Office 2011 for Macs. For the homework you may use any version of Excel, or another spreadsheet such as LibreOffice or iWork/Numbers. However you will may to use the help pages or search the web to find instructions for using them.

Task 1:
Create a spreadsheet containing some made-up data. Make up at least 5 data points, each with an x value, a y value and an uncertainty in the y value. Save the file before you go any further (don't copy the data in these notes or anyone else's data). Now - plot the x values against the y values as a scatter plot. You will find the scatter plot command in the "insert" menu (shown below) on PC Office 2010 (or under the charts menu on Mac Office 2011).

First you need to select the data you wish to plot. Right-click on the top of the column containing the x-data and drag your mouse to the bottom of the column to select it. Hold down the control key (command on a Mac) then do the same for the y-axis data column. Now click on the scatter button and pick the option where the data points are not joined up by lines. You should have something that looks like this:


Now - add labels to your axes. A Physics graph should always have labelled axes, including units. To add a label to the x-axis click on the graph and activate the Layout tab (on a Mac, you will find the layout tab as part of the ribbon on the top). Then click on Axis Titles, Primary Horizontal Axis Title, Title Below Axis. These actions will place a text box under the x-axis in which you can type an appropriate title. To add a label to the y-axis click on Axis Titles, Primary Vertical Axis Title, Rotated Title. Make up some names and units for your made-up data and add appropriate labels.

Task 2: Add Error Bars
Now - add uncertainties. Click on your graph and activate the Layout tab (Charts/Layout on the Mac ribbon). Click on the Error Bars icon and select More Error Bar Options.... This will bring up the Format Error Bars window, as shown below.


By default Excel asks you to enter the vertical, or y-error values first. Select Both under the Direction options and Cap under the End Style options. Sometimes the y-error is the same for all points, in which case the value can be entered in the Fixed value cell. However, to keep things general we will use the Custom option ­ this works for all cases. Select Custom from the Error Amount options and click on the Specify Value button. You must first enter the Positive Error Value (the `up error bars') ­ click at top of the column of y error values and drag down to select all of the values (in the above screenshot the y error values are in the column labeled ). Next, click on the icon next to the Negative Error Value (the `down error bars'), highlight the column of error values, click on the icon next to the cell, and then click in OK. You should now see the y-error bars on your plot. You will also notice that Excel has added arbitrary horizontal error bars to the data points. To enter the correct values of the x-errors you must first select the horizontal error bars. You can do this by left clicking on one of the horizontal error bars in your plot (you may have to use the zoom bar at the bottom right of the Excel window) or by selecting Series 1 X Error Bars from the drop down menu in the Current Selection section at the top left of the Layout tab. Once you have selected the error bars you can enter the correct values by following the same procedure you used to enter the y-error values. When you are done your graph should look something like that shown below. Notice that the x-error bars are so small that they cannot be seen on the graph. This is fine ­ if this occurs in one of your labs simply include a statement in your logbook pointing this out.


Task 3: Compare to a model
To compare your data to a model (as discussed in a previous lab), label a column to the right of your data with a title like `model'. The cells in this column will contain the y coordinates of your model, which you will eventually plot in the graph of your data. Any model you come up with will have some free parameters which determine its shape, and which you will adjust to get the best fit to the data. If your model is a straight line, there are two such free parameters, the "intercept" a and the "gradient" b, which control a line of shape y = a + bx. Let's try fitting a straight line. Somewhere in your spreadsheet label two adjacent cells as `slope' and `intercept'. These cells will contain the slope and intercept of your test line. Start by guessing slope (gradient) and intercept values into these cells. Next, in the first cell of your `test line' column enter a formula which multiplies your first mass value (your first x-coordinate) by the value in your `slope' cell and then adds the value in your `intercept' cell. Make sure that you insert $ symbols before and after the column label of your `slope' and `intercept' cells. At this point your worksheet will look something like:


When you have pressed enter and autofilled the max/min line column you can plot your test line over your data. To do this click somewhere in your graph and then activate the Design tab. Click on the Select Data icon and then click the Add button in the window that appears. In the Series name window type something like `test line'. Then click on the icon to the right of the Series X values window and highlight your column of x values (the column of mass values). Click on the icon again and repeat the process to enter the column of max/min line y values into the Series Y values window. When you click OK Excel will plot your test line on your graph as a series of points. To make your test line appear as a line instead of a series of points activate the Layout tab and select the `test line' option from the pull down menu in the Current Selection section. Then click on the Format Selection option in the same section and select None from the Marker options. Then click on the Line style option and select one of the options from the Dash type menu. Now when you click Close your test line will appear as a dashed line in your graph. You can now play with the values in the slope and intercept cells in your worksheet to `move' your test line around and determine the best fit. Of course a straight line may not be a perfect fit - you might need a more complicated model with more free parameters. But the process is the same.