How to put errorbars
2 次查看(过去 30 天)
显示 更早的评论
Hi Everyone, How can i put errorbars in my figure below (Between red and green graphs)?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166213/image.png)
0 个评论
采纳的回答
Star Strider
2014-7-25
Use the errorbar function on the line of your choice. The easiest way to do this is to plot that line, then use hold to plot the others:
figure(1)
errorbar(Traffic, EngsetPb, barvector)
hold on
plot( ... the rest ... )
hold off
grid
Hypothetical variables here.
更多回答(2 个)
Wayne King
2014-7-25
编辑:Wayne King
2014-7-25
Do you have the Statistics Toolbox?
x = 1:10;
y = sin(x);
e = std(y)*ones(size(x));
plot(x,y,'b')
hold on
errorbar(x,y,e,'bo','markerfacecolor',[0 0 1])
Not sure exactly what you mean by "between red and green graphs"
I'm assuming that each data point is an estimate and you have an associated confidence inteval that you want to represent
2 个评论
Wayne King
2014-7-25
Presumably this probability comes with some associated error, you just want to use that error in errorbar()
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Errorbars 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!