[a very silly question!] How to calculate the errorbar with 2 standard deviations in this example?
x=1:10;
y=rand(10,50);
errorbar(x, mean(y,2), std(y,[],2)) % 1 standard deviation
Just multiplying std by 2 in the errorbar, right?
errorbar(x, mean(y,2), 2 * std(y,[],2))

 채택된 답변

Star Strider
Star Strider 2021년 3월 3일

1 개 추천

Not silly at all, however it may not produce the result you want.
It might be more appropriate to calculate the errors as the standard error of the mean (S.E.M.) :
err = 2*(std(y,[],2)/sqrt(size(y,2))); % 2 x Standard Error Of The Mean
then:
figure
errorbar(x, mean(y,2), err) % 2 standard errors of the mean
rather than the standard deviation of the observations themselves.

댓글 수: 4

Sim
Sim 2021년 3월 3일
편집: Sim 2021년 3월 3일
Thanks a lot @Star Strider, very kind!
@Rik: many thanks for your reply too, even though I cannot see it anymore!
P.S.: I would have accepted both answers!
Star Strider
Star Strider 2021년 3월 3일
As always, my pleasure!
Rik
Rik 2021년 3월 3일
You're welcome.
(I deleted my answer as it overlapped with this answer too much, and this one was better)
Star Strider
Star Strider 2021년 3월 3일
@Rik I very much appreciate your compliment!

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

추가 답변 (0개)

카테고리

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

질문:

Sim
2021년 3월 3일

댓글:

2021년 3월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by