# How to calculate uncertainty of gradient of straight line?

Tags:
1. Nov 18, 2016

### henry wang

Mod note: Moved from a technical forum section, so missing the homework template.
I am analysing the data from my undergrad experiment, which the aim is to find the Plank's constant by scattering x-ray off NaCl crystal and using Braggs law.
The straight-line equation is as follows: $$eV=h\frac{c}{2dsin(\theta)}$$. I am only considering the uncertainty in theta since it is the dominant uncertainty in my experiment.
To find the uncertainty in the Planks constant, h, I rearranged the above equation to $$h=\frac{2eVdsin(\theta)}{c}$$ and used the error propagation equation and found $$\Delta h=\frac{2eVdcos(\theta)\Delta \theta}{c}$$. I have 16 data points of different x-ray energies, so I found dh of all 16 data points and took its average. Is this a good approach?
PS: Should I move this thread to the Homework and Coursework section?

Last edited by a moderator: Nov 19, 2016
2. Nov 18, 2016

### Cutter Ketch

So I presume these 16 measurements were 16 different x ray energies and you measure theta for each one, or were these 16 repeated measurements and you just have random scatter in theta?

3. Nov 18, 2016

### henry wang

Sorry, I should've specified, I have taken 16 measurements of different x-ray energies.

4. Nov 18, 2016

### Cutter Ketch

If they are just 16 repeated measurements with random variation in theta, then yes, your error propagation is correct.

5. Nov 18, 2016

### Cutter Ketch

Ah, that's different. To see why picture three measurements on a straight line behavior and you want to know the slope. Say all three points had the same error bar. Now picture the range of slopes you could put through the error bars of points one and two. Now picture the range of slopes you could put through the error bars of points 1 and 3. The end points put a much harder constraint on the possible slopes than adjacent points. If you look at what slopes points 1 and 3 allow you see that point two adds very little extra constraint. So how the points are spread out affects the constraint on the slope.

At the extreme, assume a whole bunch of points are close together on the x axis and one single measurement is far to the right. The error in that single measurement has a much greater impact on the uncertainty of the slope than the other points do.

6. Nov 18, 2016

### henry wang

So should I plot y=hx and find h_min and h_max by fitting line using the uncertainty in x and y?
The problem is, however, if y=eV and x=c/(2dsin(theta)), the associated uncertainty in x will be HUGE.

Last edited: Nov 18, 2016
7. Nov 18, 2016

### Cutter Ketch

No, the energy is the thing you have confidence in and the angle is the thing you measured and think you have uncertainty in. Plot energy as x and angle (or better yet sine(angle)) as y. Regarding uncertainty, the error bars shouldn't be large compared to the size of the values, right?

Unfortunately this isn't a straight line, so I'm not sure they wanted you to go in this direction. I think I am misleading you.

8. Nov 18, 2016

### Cutter Ketch

BTW I thought I would reiterate. The title of the post is incorrect. The thing you varied is Energy. The thing you measured is angle. They are not directly proportional. They are inversely proportional. h is not proportional to the slope of a straight line. Unless you want the complicated version, I think a simplified way of looking at it is in order. You probably took each measurement as an independent measurement of h without regard to the energy and averaged the values. In that case I think what you did to propagate the error is a reasonable approach.

Your measurements actually can produce a much better estimate of h by least squares, and while the error in the least squares estimate is much smaller, calculating it is much harder to follow.

9. Nov 19, 2016

### henry wang

I plotted eV=hc/lambda using excel, where it gave me a straightline. (lambda is 2dsin(theta), y is eV and x is c/lambda) It does linear least squares for me, and gave me h=6.745*10^-34. I think I will take your advice to plot max and min gradient lines permitted by my uncertainties and find out h_max and h_min.
Thank you very much!

Last edited: Nov 19, 2016