Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to plot an error bar plot with standard deviation values in MATLAB?

Tags:

plot

matlab

I am very new to MATLAB and expect a step-by-step solution. I have data, series(y), which I have to plot against (x). Also I have the standard deviation values for each data point of (y). Now I have to plot these series highlighting the error bars. How can I do that?

The data is in a text file sorted in columns as:

X = -50, -49, -48, -47....0....1, 2, 3, 4, 5....till 50

Y = 1.2, 1.0, 1.1, 1.9, 1.3.....

Standard deviation = 0.6, 0.5, 0.3, 0.6, 0.6.....

Also, how do I control the ticks and appearance property for these kinds of graphs?

like image 877
user1011350 Avatar asked Oct 24 '11 17:10

user1011350


People also ask

How many standard deviations do we plot as error bars?

Error bars often represent one standard deviation of uncertainty, one standard error, or a particular confidence interval (e.g., a 95% interval).

Does standard deviation have error bars?

An error bar is a line through a point on a graph, parallel to one of the axes, which represents the uncertainty or variation of the corresponding coordinate of the point. In IB Biology, the error bars most often represent the standard deviation of a data set.


1 Answers

x = 1:0.1:10;
y = sin(x);
e = 0.1 * randn(length(x), 1);

errorbar(x,y,e)

set(gca, 'Xlim', [4 10])
set(gca, 'XTick', 4:2:10)

enter image description here

See also get(gca) and get(gcf) for other properties to change.

For help on any of these functions, do, for example, help errorbar.

like image 51
John Colby Avatar answered Nov 15 '22 07:11

John Colby