How to create one errorbar for multiple data points?

11 views (last 30 days)
i want to plot a x-vector (1,100) and a y-vector (1,100) with an errorbar. I have already calculated the single value for the standard deviation of the y-vector. This y-vector has been measured 100 times, so i just need one standard deviation for the 100 values of y.
I tried to do this with:
x = ones(1,100);
y = ...;
error = 4.17e-04;

Accepted Answer

Daniel Pollard
Daniel Pollard on 3 Feb 2021
If I understand you right, could you do something like
figure; hold on
plot(x, y, 'bx')
errorbar(mean(x), mean(y), std(y), 'k+')
hold off
which I believe should plot all of your y values at x=1, and then overlay an errorbar centred at the mean point with a size equal to the standard deviation of y.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!