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

  • Context: Undergrad 
  • Thread starter Thread starter K41
  • Start date Start date
  • Tags Tags
    Data Plotting
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
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.