matlab连续型随机变量的分布.doc
连续型随机变量的分布及其数字特征一、基本概念设随机变量X的分布函数为F(x),若存在非负函数f(x),使对任意实数x,有≤X{Pxd}则称X为连续型随机变量,并称f(x)为X的概率密度,它满足以下性质:①f(x)≥0,-∞<x<+∞;②;③P{a0,则称X服从参数为和2的正态分布,记作X~N(,2).当=0,=1时,称X服从标准正态分布,记作X~N(0,1).MATLAB提供的有关正态分布的函数如下:normpdf(X,M,C)正态分布的密度函数normcdf(X,M,C)正态分布的累积分布函数norminv(P,M,C)正态分布的逆累积分布函数normrnd(M,C,m,n)产生服从正态分布的随机数normstat(M,C)求正态分布的数学期望和方差其中X为随机变量,M为正态分布参数,C为参数,P为显著概率,m和n为随机矩阵的行数和列数.绘制标准正态分布的密度函数及累积分布函数图和一般正态分布的密度函数及累积分布函数图的程序如下:x=-4:0.01:4;y=normpdf(x,0,1);z=normcdf(x,0,1);-0.100.10.20.305101520-0.100.10.20.300.51-4-202400.20.4-4-202400.5105101500.20.40.605101500.51subplot(2,2,1);plot(x,y, k );axis([-4,4,-0.1,0.5]);subplot(2,2,2);plot(x,z, k );axis([-4,4,-0.1,1.1]);x=-4:0.01:16;y1=normpdf(x,6,1);z1=normcdf(x,6,1);y2=normpdf(x,6,4);z2=normcdf(x,6,4);y3=normpdf(x,6,0.6);z3=normcdf(x,6,0.6);subplot(2,2,3);plot(x,y1, k ,x,y2, k ,x,y3, k );axis([-4,16,-0.1,0.8]);subplot(2,2,4);plot(x,z1, k ,x,z2, k ,x,z3, k );axis([-4,16,-0.1,1.1]);三、求解方法(1)通用函数介绍.Pdf计算已选函数的概率密度函数,调用格式为:Y=Pdf(name,X,A)Y=Pdf(name,X,A,B)Y=Pdf(name,X,A,B,C)Name为上表中取stat后的字符,如beta、bino、chiz、exp等。(2)利用专用函数.Betapdf(X1,A1,B)Binopaf(X,N,P)四、例题绘制卡方分布密度函数在n分别等于1,5,15时的值>>x=0:0.2:30y1=chi2pdf(x,1)plot(x,y1, + )holdony2=chi2pdf(x,5)plot(x,y2, + )y2=chi2pdf(x,15)plot(x,y2, o )axis([0,30,0,0.2])Columns1through1300.20000.40000.60000.80001.00001.20001.40001.60001.80002.00002.20002.4000Columns14through262.60002.80003.00003.20003.40003.60003.80004.00004.20004.40004.60004.80005.0000Columns27through395.20005.40005.60005.80006.00006.20006.40006.60006.80007.00007.20007.40007.6000Columns40through527.80008.00008.20008.40008.60008.80009.00009.20009.40009.60009.800010.000010.2000Columns53through6510.400010.600010.800011.000011.200011.400011.600011.800012.000012.200012.400012.600012.8000Columns66through7813.000013.200013.400013.600013.800014.000014.200014.400014.600014.800015.000015.200015.4000Columns79through9115.600015.800016.000016.200016.400016.600016.800017.000017.200017.400017.600017.800018.0000Columns92through10418.200018.400018.600018.800019.000019.200019.400019.600019.800020.000020.200020.400020.6000Columns105through11720.800021.000021.200021.400021.600021.800022.000022.200022.400022.600022.800023.000023.2000Columns118through13023.400023.600023.800024.000024.200024.400024.600024.800025.000025.200025.400025.600025.8000Columns131through14326.000026.200026.400026.600026.800027.000027.200027.400027.600027.800028.000028.200028.4000Columns144through15128.600028.800029.000029.200029.400029.600029.800030.0000y1=Columns1through13Inf0.80720.51640.38150.29900.24200.19990.16740.14170.12090.10380.08950.0776Columns14through260.06740.05880.05140.04500.03950.03480.03060.02700.02380.02110.01860.01650.0146Columns27through390.01300.01150.01030.00910.00810.00720.00640.00570.00510.00460.00410.00360.0032Columns40through520.00290.00260.00230.00210.00180.00170.00150.00130.00120.00110.00090.00090.0008Columns53through650.00070.00060.00050.00050.00040.00040.00040.00030.00030.00030.00020.00020.0002Columns66thro