随机过程作业
姓 名: 陈博飞
学 号: S310040125
专 业: 控制理论与控制工程
任课教师: 彭秀艳 教授
2011 年 11 月
第一题:
用 PC 机产生[0,1]均匀分布的白色序列
要求:(1) 打印出前 50 个数;
(2) 分布检验;
(3) 均值检验;
(4) 方差检验;
(5) 计算出相关函数 。
解:
源程序:
clear all
close all
x=rand(1,2000);
EX=mean(x)
DX=var(x)
subplot(2,1,1),hist(x,10);
y=linspace(-10,10,21);
for m= -10 :10
mAbs=abs(m);
s=0;
for n=1:2000-mAbs
s=s+(x(n+mAbs)-EX)*(x(n)-EX);
end
y(m+11)=(1/(2000-mAbs))*s;
end
x2=[-10:20/20:10];
subplot(2,1,2),plot(x2,y)
1.前 50 个数:
>> x(1:50)
ans =
0.9501 0.2311 0.6068 0.4860 0.8913 0.7621 0.4565
0.0185 0.8214 0.4447 0.6154 0.7919 0.9218 0.7382
0.1763 0.4057 0.9355 0.9169 0.4103 0.8936 0.0579
0.3529 0.8132 0.0099 0.1389 0.2028 0.1987 0.6038
0.2722 0.1988 0.0153 0.7468 0.4451 0.9318 0.4660
0.4186 0.8462 0.5252 0.2026 0.6721 0.8381 0.0196
0.6813 0.3795 0.8318 0.5028 0.7095 0.4289 0.3046
0.1897
2.分布检验:
3.均值检验:
EX = 0.5007
4.方差检验:
DX = 0.0845
5.计算相关函数:
第二题:
用 PC 机产生 分布的正态序列
要求:(1)打印出前 50 个数;
(2)分布检验;
(3)均值检验;
(4)方差检验;
(5)计算出相关函数
解:
源程序:
clear all
close all
x=normrnd(0,1,1,2000);
EX=mean(x)
DX=var(x)
subplot(2,1,1),hist(x,20);
y=linspace(-20,20,41);
for m= -20 :20
mAbs=abs(m);
s=0;
for n=1:2000-mAbs
s=s+(x(n+mAbs)-EX)*(x(n)-EX);
end
y(m+21) = s/(2000-mAbs);
end
x2=[-20:20/20:20];
subplot(2,1,2),plot(x2,y);
1.打印出前 50 个数:
>> x(1:50)
ans =
0.4354 0.2860 0.7165 0.1721 -0.5351 -0.5935 1.3927
-0.9967 -1.3440 -0.4453 0.5171 -0.3880 -0.6164 0.4411
0.8992 -0.0202 -0.9211 1.8981 -1.3016 -1.0377 -0.2264
-0.8276 1.3965 0.1892 -0.2167 1.5195 -0.4780 0.6447
-0.8237 -0.3359 -1.0771 0.3496 -0.8473 -0.7885 0.3836
1.0033 -1.5332 -0.9446 -0.1871 -0.9863 -1.1815 -0.9733
1.3108 0.2486 -2.2585 0.2459 -0.1211 -0.4718 1.9790
-0.4021
2.分布检验:
3.均值检验:
EX = -0.0279
4.方差检验:
DX = 1.0113
5.计算相关函数: