![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/537406/image.png)
standard deviation in errorbar
100 次查看(过去 30 天)
显示 更早的评论
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))
0 个评论
采纳的回答
Star Strider
2021-3-3
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.)
:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/537406/image.png)
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 个评论
Rik
2021-3-3
You're welcome.
(I deleted my answer as it overlapped with this answer too much, and this one was better)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Errorbars 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!