Undergrad Data Plotting Help: Calculating Error Bars for Gradients and Average Gradient

  • Thread starter Thread starter K41
  • Start date Start date
  • Tags Tags
    Data Plotting
Click For Summary
The discussion focuses on calculating error bars for gradients derived from an experiment observing water volume over time. To determine error bars for individual gradients, standard deviation of the volumes can be used to compute standard error. For the average gradient, a weighted average is recommended, using inverse squares of uncertainties as weights, although an unweighted average may suffice if uncertainties are similar. The use of Matlab's polyfit and polyval functions is mentioned for obtaining the line of best fit and its gradient. Overall, the conversation emphasizes the importance of accurately calculating uncertainties in experimental data analysis.
K41
Messages
94
Reaction score
1
I'm doing an experiment at work where I am observing an "event" over time. This event can be anything, but let's assume its a bucket of water being filled to the top, then it gets replaced with another bucket and I watch the whole "event" again.

So x-axis will be time, y-axis will be the volume of water in the bucket at time, x. For the first observation, I put a line of best fit which models how the volume of water increases with time. I get the gradient from this. I then plot the next event. I get another gradient. I then plot the third event. I get a third gradient and so fourth.

1) Now here comes an issue. I want to plot the gradient against the event number. This is easily doable. But how would I work out what the error bars would be for each gradient?

Potential Ans. I'm thinking maybe I have to find the standard deviation of the volumes and then get a standard error from this and use that for my error bars?

2) Also, I have plotted an average gradient (its the mean of all the gradients). I want to find the error bar for this. How do I do that?

Potential Ans: I'm thinking just find the standard deviation of the gradients, then compute the standard error. But I'm not sure how the error bars from each individual gradient should be taken into account.

Any advice?
 
Physics news on Phys.org
djpailo said:
But how would I work out what the error bars would be for each gradient?
How do you get the central value? Every good approach (=a fit) should give both at the same time.
djpailo said:
2) Also, I have plotted an average gradient (its the mean of all the gradients). I want to find the error bar for this. How do I do that?
Make a weighted average of the gradients, where the weights are the inverse squares of the uncertainties. If the uncertainties are all very similar, an unweighted average can do the job as well.
 
mfb said:
How do you get the central value? Every good approach (=a fit) should give both at the same time.
Make a weighted average of the gradients, where the weights are the inverse squares of the uncertainties. If the uncertainties are all very similar, an unweighted average can do the job as well.

My measurements of the volume are taken with a code (processing experimental data) in Matlab. I use the polyfit and polyval function to put a line of best fit and this gives me its intercept and gradient. (Polyfit gives the line of best fit and polyval enables me to plot the line of best fit over the data points).

I understand the second answer, thanks.
 
First trick I learned this one a long time ago and have used it to entertain and amuse young kids. Ask your friend to write down a three-digit number without showing it to you. Then ask him or her to rearrange the digits to form a new three-digit number. After that, write whichever is the larger number above the other number, and then subtract the smaller from the larger, making sure that you don't see any of the numbers. Then ask the young "victim" to tell you any two of the digits of the...

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
28
Views
4K
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 18 ·
Replies
18
Views
3K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 37 ·
2
Replies
37
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
8K