plotting error bars in both x and y data

Hi, i want to plot data set x vs y. Now i have different error values ​​in x and y. I want to plot error in both planes. The command error bar plots same error either horizontally, vertically or in both directions. But i want to plot different sets of errors in x and y. how can i do that. many thanks for your help.

 Accepted Answer

I am not certain what the problem is.
.

4 Comments

lets suppose i have this simple set of data. this will plot me error bars either in horizontal or in vertical or in both, but with the same error in both directions. i want error bar in x and y according to err_x and err_y respectively. the error is plus-minus around the central value. I am not sure how can i control the length of error bars for this example.
x=[1:8];
y=[1:8];
err_x=[0.2,0.1,0.5,0.3,0.4,0.9,1.2,0.6];
err_y=[0.4,0.9,1.5,0.2,0.3,0.9,1.4,0.9];
plot(x,y)
hold on
errorbar(x,y,err_x,err_y)
I would just do:
errorbar(x,y,err_y,err_y,err_x,err_x)
assuming that is the result you want.
thankd for your comment. I noticed you took the error in y first and then the error in x. is this just to have the right direction in matlab?
is this just to have the right direction in matlab?
That is how the errorbar documentation says to order them. Please read the documentation section I linked to in my original Answer.

Sign in to comment.

More Answers (0)

Categories

Find more on App Building in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!