matlab程序画累积直方图

来源:百度知道 编辑:UC知道 时间:2024/06/17 00:56:44
有一个简单的小程序:
a1=binornd(1000,0.1,[10,100])
a2=binornd(1000,0.2,[10,100])
s=a1+a2
p1=s-300
p2=p1/sqrt(250)
揭晓来如何编程画出p2的累积直方图?
请哪位高手指点
是“接下来”,不好意思打错了

不知道矩阵是怎么统计的,但累加图可以画,例子如下,可以参考:
% a1=binornd(1000,0.1,[10,100]) ;
% a2=binornd(1000,0.2,[10,100]) ;
% s=a1+a2 ;
% p1=s-300;
% p2=p1/sqrt(250);
x = -2.9:0.1:2.9;
y = randn(10000,1);
figure(1), hist(y,x)
n_elements = histc(y,x);
c_elements = cumsum(n_elements);
figure(2),bar(x,c_elements);

hist