MATLAB: Plot with error bars to show upper and lower bounds

errorbarupper and lower boundaries

I'm looking to generate a plot where the upper and lower bounds of the data are displayed above and below the mean. There is a package that allows you to plot the upper and lower boundaries of a curve, but I would like to do this for a scatter plot. To my knowledge, I can't use errorbar, because the anticipated inputs are standard deviations. What I need is something that frames the upper and lower bounds of the data. For instance if the mean = 10, the lower bound may be 7 and the upper bound may be 15. Ideally, in this hypothetical situation, I want a point at 10 and bar that extends from 7 to 15. Any suggestions?

Best Answer

The errorbar error bar limits can be anything you want them to be. They are not restricted to be standard deviations or anything else.
Example
x = 1:10; % Create Data

y = randi(9, 1, 10); % Create Data
ub = y + randi(5, 1, 10); % Create Data: Upper Bound
lb = y - randi(3, 1, 10); % Create Data: Lower Bound
figure(1)
errorbar(x, y, lb, ub, 'pg')
axis([0 11 ylim])