matlab errorbar 例子,matlab errorbar

On the group meeting of Oct 3, 2018, Jiaqi shows his bar. I asked that why his variance is very small. He said that he uses the standard error (https://en.wikipedia.org/wiki/Standard_error), which is standard derivation divided by the square root of the number of trials. According to the notes of my undergraduate course probability:

(1) D(ax+b) = a*a*D(x),

(2) the second line of "中心极限定理". x bar is seen as a random variable,

we have std(x bar) = std(x)/sqrt(n).

I ask Jiaqi which tool he uses to draw his figure. He says he uses python, bar of matplotlib. https://matplotlib.org/api/_as_gen/matplotlib.pyplot.bar.html. The mean of the errors and standard error should be computed first and then be used as the input of xerr and yerr.

I check my TNNLS 2017 paper and I find that I show the std. Maybe next time I can show the standard error.

这个函数的意思是:

ERRORBAR(X,Y,L,U),X是自变量,Y是因变量,L是Y的变动下限,U是Y的变动上限

errorbar(X,Y,E) X是自变量,Y是因变量,E是Y的变动绝对差值。我自己写的例子:

X=[1 2 3];

Y= [ 0.2 0.4 0.2];

L=[0.1 0.03 0.03];U=[0.1 0.3 0.2];

E= [0.1 0.3 0.2];

figure;

hold on;%一定要有这一句,否则有问题

bar(X,Y);

errorbar(X,Y,E,'Marker','none','LineStyle','none');

figure;

hold on;%一定要有这一句,否则有问题

errorbar(X,Y,E);%以下注释的两句用这一句就可以了

%plot(X,Y);

%errorbar(X,Y,E,'Marker','none','LineStyle','none');

figure;

hold on;%一定要有这一句,否则有问题

bar(X,Y);

errorbar(X,Y,L,U);%,'Marker','none','LineStyle','none'不能省

说明:必须使用hold on,bar是画柱状图,errorbar是花竖线

--------------------------------------------------------------------以下可不看----------------------------------------------------------------------------

example1:

x = 1:10;

y = sin(x);

e = std(y)*ones(size(x));

errorbar(x,y,e)

694f24fddba6bf584e2fe58294695a10.pngexample2: 

% 生成示例数据x=1:10;y=cumsum(randn(1,10));lower= y -(rand(1,10));upper= y +(rand(1,10));% 由于errorbar函数使用相对差值在图形上绘图,所以% 需要将绝对差值转变为相对差值。L = y -lower;U =upper-y;% 绘图时需要设定 hold on% 柱状图clf;figure(1);holdon;bar(x,y);% 此处需要隐藏折线errorbar(x,y,L,U,'Marker','none','LineStyle','none');% 折线图figure(2);hold('on');plot(x, y);errorbar(x, y, L, U);

Reference:

http://blog.sina.com.cn/s/blog_61010ebe0100l9c9.html

http://bio-spring.info/wp/?p=85

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值