Plotting errorbar on a set of data

5 views (last 30 days)
Reinhardt RADING
Reinhardt RADING on 14 Apr 2021
Commented: Star Strider on 15 Apr 2021
I have results got from simulation. The results vary both with A and B. (The simulation results increases with an increase in value of A and increase in spacing value).
I would like to plot errorbar resulting from standard deviation.
I'm not sure how to do this.
Kindly assist.
See below data. (Not the correct data but similar to this).
Thanks
A spacing a spacing b spacing c spacing d spacing e
0.1 0.4 0.2 0.26 0.56 0.34 0.23 0.54
1 0.7 0.5 0.56 0.86 0.64 0.53 0.84
1.5 1 0.8 0.86 1.16 0.94 0.83 1.14
2 1.3 1.1 1.16 1.46 1.24 1.13 1.44
2.5 1.6 1.4 1.46 1.76 1.54 1.43 1.74
3 1.9 1.7 1.76 2.06 1.84 1.73 2.04
3.5 2.2 2 2.06 2.36 2.14 2.03 2.34
4 2.5 2.3 2.36 2.66 2.44 2.33 2.64

Answers (1)

Star Strider
Star Strider on 14 Apr 2021
I do not see ‘B’ anywhere.
With ‘A’ as the matrix in the post, try this:
Amean = mean(A(:,2:end),2);
Astd = std(A(:,2:end),[],2);
figure
errorbar(A(:,1), Amean, Astd)
grid
I have no idea why all the standard deviations are the same, since the data appear to be different.
  4 Comments
Reinhardt RADING
Reinhardt RADING on 15 Apr 2021
My plot are like this, but i would love to add errorplot. How can i do this?
I have seen your answer here i though i didnt understand it (i'm novice using Matlab).
Thanks for your help.
Star Strider
Star Strider on 15 Apr 2021
Plotting error bars requires having some measure of the dispersion of the data (usually standard deviation or some derived measure, such as confidence intervals).
The original posted data do not appear to have any relationship (that I can see) to the data in the plot. If you provide a representative sample data set you want to plot, a description of what is in it, and what you want from it, I can probably help.

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!