Plotting errorbar on a set of data
2 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Star Strider
2021-4-14
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 个评论
Star Strider
2021-4-15
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Errorbars 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!