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

In summary, the individual gradients can be plotted against the event number, and the error bars can be calculated by finding the standard deviation of the volumes and computing the standard error. To find the error bar for the average gradient, a weighted average can be used with the inverse squares of the uncertainties as weights. However, if the uncertainties are similar, an unweighted average can also be used. The central value for the line of best fit can be obtained using the polyfit and polyval functions in Matlab.
  • #1
K41
94
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
  • #2
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.
 
  • #3
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.
 

1. How do I plot my data on a graph?

To plot your data on a graph, you will need to first determine what type of graph is appropriate for your data (such as a line graph, bar graph, or scatter plot). Then, using a software like Excel or R, you can input your data and create a graph using the appropriate tools provided by the software. Alternatively, you can also plot your data manually using graph paper and a ruler.

2. What is the best way to label my axes?

The best way to label your axes is to include a clear and concise label for both the x-axis and y-axis. It is also important to include units for your data, such as time, distance, or quantity. Additionally, you may want to include a title for your graph that summarizes the overall purpose or main findings of your data.

3. How do I choose the appropriate scale for my graph?

Choosing the appropriate scale for your graph depends on the range and distribution of your data. If your data has a wide range, it may be best to use a logarithmic scale. If your data is evenly distributed, a linear scale may be more appropriate. It is also important to ensure that your scale is easy to read and understand for the audience.

4. Can I change the colors and style of my graph?

Yes, you can change the colors and style of your graph to make it more visually appealing and easier to interpret. Most software programs allow you to customize the colors, fonts, and other design elements of your graph. However, it is important to ensure that the changes you make do not distort or misrepresent your data.

5. How can I add error bars to my graph?

To add error bars to your graph, you can use a software like Excel or R which have built-in tools for adding error bars to your data points. You can also manually calculate the error and add it to your graph using the "custom" error bar option. Error bars are useful for showing the variability or uncertainty of your data points and can help improve the accuracy of your graph.

Similar threads

  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
930
  • Set Theory, Logic, Probability, Statistics
Replies
28
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
18
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
1K
  • Set Theory, Logic, Probability, Statistics
2
Replies
37
Views
4K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
3K
  • Set Theory, Logic, Probability, Statistics
Replies
18
Views
3K
  • Set Theory, Logic, Probability, Statistics
2
Replies
40
Views
4K
  • Set Theory, Logic, Probability, Statistics
Replies
4
Views
1K
Back
Top