Hi all,
I am trying to create one error bar but I am struggling a lot.
I tried to read the matlab documentation about error bars but the site is down for some reason.
Anyway, I have calculate the standard deviaiton (s=4.13) but I am confused witht the x,y axes
the x axis should be 1 value and the y axis has a range from 0 to 14
please let me know what you think
many thanks
Nikolas

댓글 수: 5

dpb
dpb 2019년 9월 11일
Normally one can install the documentation locally on installation just as an aside...
Not sure from the description what you're trying to actually represent -- what's the x,y values for which to plot an errorbar?
Just
x=1; y=8.35;
sd=4.13;
errorbar(x,y,sd,'*')
ylim([0 14])
xticks([0:2])
will create a figure that would match the above description albeit relatively devoid of information being only a single point. But, if that's all one has, so be it...
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2019년 9월 13일
ok thanks..However I don't understand what is y? is the mean value? Moreover, how I can get a bar instead of a star? sorry but I haven't used them before and I am a bit confused thanks again
dpb
dpb 2019년 9월 13일
Well, you must have an ordinate point which is the "y" as a minimum as well as an associated error value for any plot, the abscissa can be omitted in which case will be the ordinal number by default. errorbar is no different than plot in that regards.
You didn't provide any information other than a computed std deviation value; I just made up a pair of x,y values for the example that would fit into the ylim range you did indicate.
linespec is defined same as for plot, just add the triplet letters for marker, color, line as wanted.
(x,y) are the coordinate you're adding the error bar to.
neg and pos the lower and upper length of the error bar.
so, this line
errorbar(3,4,1,2, 'o')
plots a point at (3,4) and the errorbar extens downward by 1 y-unit and upward by 2 y-units.
Nikolas Spiliopoulos
Nikolas Spiliopoulos 2019년 9월 14일
Alright, thanks a lot I am gonna have a look at website too!!

댓글을 달려면 로그인하십시오.

 채택된 답변

Prabhan Purwar
Prabhan Purwar 2019년 9월 16일

0 개 추천

Hi,
Bar chart can be created by making use of bar and errorbar functions as shown in the following code.
x=1; y=8.35;
sd=4.13;
bar(x,y);
hold on
errorbar(x,y,sd)
ylim([0 14])
xticks([0:2])
hold off
Output:
untitled.jpg
Please refer the following link for further information on errorbarfunction
Hope this helps

댓글 수: 1

dpb
dpb 2019년 9월 16일
Ah! Maybe THAT was what OP mean by "how to get a bar instead of *"...I couldn't figure that one out and there was no further input.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Errorbars에 대해 자세히 알아보기

태그

질문:

2019년 9월 11일

댓글:

dpb
2019년 9월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by