Random Walk Problem
Random Walk Problem
Below you will find a homework problem for use with the Random Walk program. Please send your comments or questions to Suzanne Mohney at [email protected]. Use the computer program Random Walk on a Mac or PC in our departmental computer classroom to uncover the relationship between the number of random jumps atoms make during a one dimensional diffusion experiment and the average (or more properly root-mean-square average) distance the atoms travel. Note that many of the jumps the atoms take bring them right back where they just came from, so the net distance traveled is much less than the number of jumps multiplied by the distance of an individual jump. You can run the simulation for any number of jumps from 1-9999, obtaining data for 1-9999 atoms. The more atoms you include, the better your data, but the longer it will take to run the program. Once you finish collecting data from the Random Walk program, use the curve fitting feature in Excel (tutorial by Gary L. Gary provided on the following pages) to find the functional relationship requested. Be sure to consider how physically reasonable your solution is before you settle upon it.
You might want to model this process or see that it fits a model that you already have. Since this data is clearly not linear, how do you find the best equation that fits the data? That is where nonlinear curve fitting comes in. Nonlinear Curve Fitting You begin by entering your data into Microsoft Excel. To do this, simply run Excel and enter your data as shown below.
The data corresponding to the abscissa or x-axis should be in the left column and the data corresponding the ordinate or y-axis should be in the right column. After entering your data, select it as shown below (it works best if you just select the data and not the headings). Notice that the cells are colored when they are selected.
Now go to the Insert menu and select Chart. A dialog box will appear in which you should select the XY (Scatter) type of plot as shown below.
Now you can either click the Next button if you want to modify some of the finer points of the plot or click on Finish to get the plot. Your spreadsheet should now look something like the picture shown below.
Now, select the picture as shown and go the Chart menu and select Add Trendline. Note that if you do not select the plot, a Chart menu will not appear. In the Add Trendline dialog box that appears, you will now need to choose the type of curve to fit to your data. In this case, I will choose a second-order polynomial as shown below.
Last Modified: 10/21/13
Then click on the Options tab and tell Excel that you would also like it to display the Equation and the R-squared value as shown.
Now click the OK button and the curve as well as the equation and the r-squared value will appear on your plot. Notice that this curve does not fit the data too well (you can see
this visually as well as with the low r-squared value), so I will now add another type of curve, in this case an exponential curve. Both curves are shown below.
30000.0000
2 y = 463.03x - 3110.9x + 2777.5 2 R = 0.8147
25000.0000
20000.0000
1.0022x y = 1.0449e R2 = 0.9999
15000.0000
10000.0000
5000.0000
Notice that the dashed exponential curve visually fits the data very well and has an rsquared value that is nearly one. You could try other curves, but you will find that the exponential curve is by far the best fit. With this in mind, you can see that the equation of the curve is approximately
1 . 0 0 x y = 1 . 0 4 5 e x In fact, the equation I used to originally generate the data was y= with a little bit of e random noise added to the y-value of each data point.