Demo entry 6644813

py

   

Submitted by anonymous on Oct 07, 2017 at 04:29
Language: Matlab. Code size: 768 Bytes.

%p2.8
x1=0+(2-0)*rand(100000,1);
[y1,n1]=hist(x1,100);bar(n1,y1);title('独立平均随机序列'),xlabel('n'),ylabel('x1');
%********************************************
x2=10+10.*randn(10000,1);
[y2,n2]=hist(x2,100);bar(n2,y2);title('高斯随机序列'),xlabel('n2'),ylabel('x2');
%******************************************
n=1:100000;%对应x1 100000个元素的序列n
[x11,n11]=sigshift(x1,n,1);
x31=sigadd(x1,n,x11,n11);
[x3,n3]=hist(x31,100);
bar(n3,x3),title('x1(n)+x1(n-1)'),xlabel('n3'),ylabel('x3');
%********************************************
y1=-0.5+(0.5+0.5)*rand(100000,1);
y2=-0.5+(0.5+0.5)*rand(100000,1);
y3=-0.5+(0.5+0.5)*rand(100000,1);
y4=-0.5+(0.5+0.5)*rand(100000,1);
x41=y1+y2+y3+y4;
[x4,n4]=hist(x41,100);
bar(n4,x4);title('Σy(n)'),xlabel('n4'),ylabel('x4');

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).