《概率論matlab實(shí)驗(yàn)報(bào)告.docx》由會(huì)員分享,可在線閱讀,更多相關(guān)《概率論matlab實(shí)驗(yàn)報(bào)告.docx(36頁(yè)珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。
1、概率論與數(shù)理統(tǒng)計(jì)matlab上機(jī)實(shí)驗(yàn)報(bào)告班級(jí):學(xué)號(hào):姓名:指導(dǎo)老師:實(shí)驗(yàn)一 常見(jiàn)分布的概率密度 、分布函數(shù)生成實(shí)驗(yàn)?zāi)康?. 會(huì)利用MATLAB軟件計(jì)算離散型隨機(jī)變量的概率,連續(xù)型隨機(jī)變量概率密度值。2.會(huì)利用MATLAB軟件計(jì)算分布函數(shù)值,或計(jì)算形如事件Xx的概率。3.會(huì)求上分位點(diǎn)以及分布函數(shù)的反函數(shù)值。實(shí)驗(yàn)要求1.掌握常見(jiàn)分布的分布律和概率密度的產(chǎn)生命令,如binopdf,normpdf2. 掌握常見(jiàn)分布的分布函數(shù)命令,如 binocdf,normcdf3. 掌握常見(jiàn)分布的分布函數(shù)反函數(shù)命令,如binoinv,norminv實(shí)驗(yàn)內(nèi)容常見(jiàn)分布的概率密度、分布函數(shù)生成,自設(shè)參數(shù)1、XB(20,0
2、.4)(1)P恰好發(fā)生8次=PX=8(2)P至多發(fā)生8次=PX=8(1)binopdf(8,20,0.4)ans =0.1797(2)binocdf(8,20,0.4)ans =0.59562、XP(2)求PX=4poisspdf(4,2)ans = 0.09023、XU3,8(1)X=5的概率密度(2)PX=6(1) unifpdf(5,3,8)ans = 0.2000(2) unifcdf(6,3,8)ans =0.60004、Xexp(3)(1)X=0,1,2,3,4,5,6,7,8時(shí)的概率密度(2)PX=8注意:exp(3)與教材中參數(shù)不同,倒數(shù)關(guān)系(1)exppdf(0:8,3)an
3、s = Columns 1 through 3 0.3333 0.2388 0.1711 Columns 4 through 6 0.1226 0.0879 0.0630 Columns 7 through 9 0.0451 0.0323 0.0232(2) expcdf(8,3)ans =0.93055、XN(8,9)(1)X=3,4,5,6,7,8,9時(shí)的概率密度值(2) X=3,4,5,6,7,8,9時(shí)的分布函數(shù)值(3)若PX=x=0.625,求x(4)求標(biāo)準(zhǔn)正態(tài)分布的上0.025分位數(shù)(1)normpdf(3:9,8,3)ans = Columns 1 through 3 0.0332
4、 0.0547 0.0807 Columns 4 through 6 0.1065 0.1258 0.1330 Column 7 0.1258(2)normcdf(3:9,8,3)ans = Columns 1 through 3 0.0478 0.0912 0.1587 Columns 4 through 6 0.2525 0.3694 0.5000 Column 7 0.6306(3)norminv(0.625,8,3)ans = 8.9559(4)norminv(0.975,0,1)ans =1.96006、Xt(3)(1)X=-3,-2,-1,0,1,2,3時(shí)的概率密度值(2)X=-3
5、,-2,-1,0,1,2,3時(shí)的分布函數(shù)值(3)若PX=x=0.625,求x(4)求t分布的上0.025分位數(shù)(1)tpdf(-3:3,3)ans = Columns 1 through 3 0.0230 0.0675 0.2067 Columns 4 through 6 0.3676 0.2067 0.0675 Column 7 0.0230(2)tcdf(-3:3,3)ans = Columns 1 through 3 0.0288 0.0697 0.1955 Columns 4 through 6 0.5000 0.8045 0.9303 Column 7 0.9712(3)tinv(0
6、.625,3)ans =0.3492(4)tinv(0.975,3)ans =3.18247、X卡方(4)(1)X=0,1,2,3,4,5,6時(shí)的概率密度值(2) X=0,1,2,3,4,5,6時(shí)的分布函數(shù)值(3)若PX=x=0.625,求x(4)求卡方分布的上0.025分位數(shù)(1)chi2pdf(0:6,4)ans = Columns 1 through 3 0 0.1516 0.1839 Columns 4 through 6 0.1673 0.1353 0.1026 Column 7 0.0747(2)chi2cdf(0:6,4)ans = Columns 1 through 3 0 0
7、.0902 0.2642 Columns 4 through 6 0.4422 0.5940 0.7127 Column 7 0.8009(3)chi2inv(0.625,4)ans =4.2361(4)chi2inv(0.975,4)ans = 11.14338、XF(4,9)(1)X=0,1,2,3,4,5,6時(shí)的概率密度值(2) X=0,1,2,3,4,5,6時(shí)的分布函數(shù)值(3)若PXP102-22代碼:Syms x yfxy=1;Ex=int(int(fxy*x,y,-x,x),x,0,1)Ey=int(int(fxy*y,y,-x,x),x,0,1)Ex2=int(int(fxy*x
8、2,y,-x,x),x,0,1)Ey2=int(int(fxy*y2,y,-x,x),x,0,1)Dx=Ex2-Ex2Dy=Ey2-Ey2結(jié)果:Ex =2/3 Ey =0 Ex2 =1/2 Ey2 =1/6 Dx =1/18 Dy =1/6P103-26代碼:Syms x yfxy=2-x-y;Ex=int(int(fxy*x,y,0,1),x,0,1);Ey=int(int(fxy*y,y,0,1),x,0,1);Ex2=int(int(fxy*x2,y,0,1),x,0,1);Ey2=int(int(fxy*y2,y,0,1),x,0,1);Dx=Ex2-Ex2;Dy=Ey2-Ey2;Ex
9、y=int(int(fxy*x*y,y,0,1),x,0,1);Covxy=Exy-Ex*Eyrxy=Covxy/(sqrt(Dx)*sqrt(Dy)D=4*Dx+Dy結(jié)果:Covxy =-1/144 rxy =-1/11 D =55/144實(shí)驗(yàn)四 統(tǒng)計(jì)中的樣本數(shù)字特征實(shí)驗(yàn)五 兩個(gè)正態(tài)總體均值差,方差比的區(qū)間估計(jì)實(shí)驗(yàn)?zāi)康? 掌握兩個(gè)正態(tài)總體均值差,方差比的區(qū)間估計(jì)方法2 會(huì)用MATLAB求兩個(gè)正態(tài)總體均值差,方差比的區(qū)間估計(jì)實(shí)驗(yàn)要求兩個(gè)正態(tài)總體的區(qū)間估計(jì)理論知識(shí)實(shí)驗(yàn)內(nèi)容P175-27代碼:x1=0.143 0.142 0.143 0.137x2=0.140 0.142 0.136 0.138
10、0.140 x=mean(x1)y=mean(x2)s1=var(x1)s2=var(x2)s=sqrt(3*s1+4*s2)/7)t=tinv(0.975,7)d1=(x-y)-t*s*sqrt(1/4+1/5)d2=(x-y)+t*s*sqrt(1/4+1/5)結(jié)果:s = 0.0026t = 2.3646d1 = -0.0020d2 =0.0061即置信區(qū)間為(-0.0020,0.0061)P175-28代碼:u=norminv(0.975,0,1)s=sqrt(0.0352/100+0.0382/100)d1=(1.71-1.67)-u*sd2=(1.71-1.67)+u*s結(jié)果:u
11、= 1.9600s = 0.0052d1 = 0.0299d2 = 0.0501即置信區(qū)間為(0.0299,0.0501)P175-30代碼:f1=finv(0.975,9,9)f2=finv(0.025,9,9)f3=finv(0.95,9,9)f4=finv(0.05,9,9)s12=0.5419s22=0.6065d1=s12/s22/f1d2=s12/s22/f2d3=s12/s22/f3d4=s12/s22/f4結(jié)果:d1 = 0.2219d2 = 3.5972d3 = 0.2811d4 = 2.8403即置信區(qū)間為(0.2219,3.5972),置信下界為0.2811,置信上界為2
12、.8403實(shí)驗(yàn)五 假設(shè)檢驗(yàn)實(shí)驗(yàn)?zāi)康? 會(huì)用MATLAB進(jìn)行單個(gè)正態(tài)總體均值及方差的假設(shè)檢驗(yàn)2 會(huì)用MATLAB進(jìn)行兩個(gè)正態(tài)總體均值差及方差比的假設(shè)檢驗(yàn)實(shí)驗(yàn)要求熟悉MATLAB進(jìn)行假設(shè)檢驗(yàn)的基本命令與操作實(shí)驗(yàn)內(nèi)容P198-2原假設(shè)H0:平均尺寸mu=32.25;H1:平均尺寸mu32.25方差已知,用ztest代碼:x=32.56,29.66,31.64,30.00,31.87,31.03h,sig,ci,zval=ztest(x,32.25,1.1,0.05)h,sig,ci,zval=ztest(x,32.25,1.1,0.01)(注:h是返回的一個(gè)布爾值,h=0,接受原假設(shè),h=1,拒絕原
13、假設(shè);sig表示假設(shè)成立的概率;ci為均值的1-a的置信區(qū)間;zval為Z統(tǒng)計(jì)量的值)結(jié)果:h = 1sig = 0.0124ci = 30.2465 32.0068zval = -2.5014h = 0sig = 0.0124ci = 29.9699 32.2834zval = -2.5014即a=0.05時(shí),拒絕原假設(shè)H0;a=0.01時(shí),接受原假設(shè)H0p198-3原假設(shè)H0:總體均值mu=4.55;H1:總體均值mu4.55方差未知,用ttest代碼:x=4.42,4.38,4.28,4.40,4.42,4.35,4.37,4.52,4.47,4.56h,sig,ci,tval=ttes
14、t(x,4.55,0.05)結(jié)果:h = 1sig = 6.3801e-004ci = 4.3581 4.4759tval = tstat: -5.1083 df: 9 sd: 0.0823h=1,即拒絕原假設(shè)H0p198-10是否認(rèn)為是同一分布需要分別檢驗(yàn)總體均值和方差是否相等原假設(shè)H0:mu1-mu2=0;H1:mu1-mu20代碼:x=15.0,14.5,15.2,15.5,14.8,15.1,15.2,14.8y=15.2,15.0,14.8,15.2,15.1,15.0,14.8,15.1,14.8h,sig,ci=ttest2(x,y,0.05)結(jié)果:h = 0sig = 0.91
15、72ci = -0.2396 0.2646h=0,即接受原假設(shè)H0,mu1-mu2=0,兩分布的均值相等;驗(yàn)證方差相等的matlab方法沒(méi)有找到可采用以下語(yǔ)句整體檢驗(yàn)兩個(gè)分布是否相同,檢驗(yàn)兩個(gè)樣本是否具有相同的連續(xù)分布 h ,sig, ksstat=kstest2(x,y,0.05)原假設(shè)H0:兩個(gè)樣本具有相同連續(xù)分布H1:兩個(gè)樣本分布不相同代碼:x=15.0,14.5,15.2,15.5,14.8,15.1,15.2,14.8y=15.2,15.0,14.8,15.2,15.1,15.0,14.8,15.1,14.8 h ,sig, ksstat=kstest2(x,y,0.05)結(jié)果:h = 0sig = 0.9998ksstat = 0.1528h=0,即接受原假設(shè)H0,兩個(gè)樣本有相同的連續(xù)分布