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.

 Réponse acceptée

Star Strider
Star Strider le 10 Août 2020

0 votes

I am not certain what the problem is.
.

4 commentaires

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.
Sumera Yamin
Sumera Yamin le 11 Août 2020
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?
Star Strider
Star Strider le 11 Août 2020
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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur App Building dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by