1、数学建模培训MATLAB统计例解MATLAB统计函数一、工具箱的使用常用分布函数1.1 常用分布函数命令含义chi2cdf(X,V)卡方分布,v是自由度 fcdf(X,V1,V2)F分布,v1,v2,为自由度expcdf(X, MU)指数分布,MU为参数 poisscdf(X,LMD)泊松分布,LMD为参数normcdf(X,MU,SIGMA)正态分布tcdf(X,V)学生分布,v是自由度 unifcdf(X,A,B)区间A,B上的均匀分布注:分布函数(Cumulative Distribution Function CDF) betacdf Beta cumulative distribut
2、ion function (cdf)binocdf Binomial cumulative distribution function (cdf)cdf Specified cumulative distribution function (cdf)chi2cdf Chi-square (2) cumulative distribution function (cdf)ecdf Empirical (Kaplan-Meier) cumulative distribution function (cdf)evcdf Extreme value cumulative distribution fu
3、nctionexpcdf Exponential cumulative distribution function (cdf)fcdfF cumulative distribution function (cdf)gamcdf Gamma cumulative distribution function (cdf)geocdf Geometric cumulative distribution function (cdf)gevcdf Generalized extreme value cumulative distribution functiongpcdf Generalized Pare
4、to cumulative distribution function (cdf)hygecdf Hypergeometric cumulative distribution function (cdf)logncdf Lognormal cumulative distribution functionnbincdf Negative binomial cumulative distribution function (cdf)ncfcdf Noncentral F cumulative distribution function (cdf)nctcdf Noncentral T cumula
5、tive distribution functionncx2cdf Noncentral chi-square cumulative distribution function (cdf)normcdf Normal cumulative distribution function (cdf)poisscdf Poisson cumulative distribution function (cdf)raylcdf Rayleigh cumulative distribution function (cdf)tcdf Students t cumulative distribution fun
6、ction (cdf)unidcdf Discrete uniform cumulative distribution (cdf) unifcdf Continuous uniform cumulative distribution function (cdf)wblcdf Weibull cumulative distribution function (cdf) 1.2 常用概率密度函数命令含义chi2pdf(X,V)卡方分布,v是自由度 fpdf (X,V1,V2)F分布,v1,v2,为自由度exppdf (X, MU)指数分布,MU为参数 poisspdf (X,LMD)泊松分布,LM
7、D为参数normpdf (X,MU,SIGMA)正态分布tpdf (X,V)学生分布,v是自由度 unifpdf (X,A,B)区间A,B上的均匀分布注:概率密度函数(Probability Density Function PDF)(以mablab7.0为例)betapdf Beta probability density function (pdf)binopdf Binomial probability density function (pdf)chi2pdf Chi-square (2) probability density function (pdf)evpdf Extreme
8、value probability density functionexppdf Exponential probability density function (pdf)fpdf F probability density function (pdf)gampdf Gamma probability density function (pdf)geopdf Geometric probability density function (pdf)gevpdf Generalized extreme value probability density function (pdf)gppdf G
9、eneralized Pareto probability density function (pdf)hygepdf Hypergeometric probability density function (pdf)lognpdf Lognormal probability density function (pdf)mvnpdf Multivariate normal probability density function (pdf)nbinpdf Negative binomial probability density functionncfpdf Noncentral F prob
10、ability density functionnctpdf Noncentral T probability density function (pdf)ncx2pdf Noncentral chi-square probability density function (pdf)normpdf Normal probability density function (pdf)pdf Probability density function (pdf) for a specified distributionpoisspdf Poisson probability density funct
11、ion (pdf)raylpdf Rayleigh probability density functiontpdf Students t probability density function (pdf)unidpdf Discrete uniform probability density function (pdf)unifpdf Continuous uniform probability density function (pdf)wblpdf Weibull probability density function (pdf) 1.3 常用随机数函数betarnd贝塔分布随机数发
12、生器chi2rnd卡方分布随机数发生器evrnd极值随机数发生器exprnd指数分布随机数发生器frndF分布随机数发生器gamrnd伽马分布随机数发生器geornd几何分布随机数发生器hygernd超几何分布随机数发生器lognrnd对数正态分布随机数发生器mvnrnd多元正态分布随机数发生器mvtrnd多元t分布随机数发生器nbinrnd负二项分布随机数发生器ncfrnd非中心F分布随机数发生器nctrnd非中心t分布随机数发生器ncx2rnd非中心卡方分布随机数发生器normrnd正态分布随机数发生器poissrnd泊松分布随机数发生器trndt分布随机数发生器unidrnd离散均匀分布
13、随机数发生器unifrnd连续均匀分布随机数发生器wblrnd威布尔分布随机数发生器举例:例如:y = mvnpdf(X) ? Undefined function or variable X. y = mvnpdf(X,mu) y = mvnpdf(X,mu,sigma) Examplemu = 1 -1; Sigma = .9 .4; .4 .3; X = mvnrnd(mu,Sigma,10); p = mvnpdf(X,mu,Sigma); 给定变量的取值,以及分布密度中参数值后,即可绘制相应的密度函数图X=linspace(1.4,2.1,100);P = normcdf(X,1.7
14、,0.1); p = normpdf(X,1.7,0.1);subplot(1,2,1),plot(X,p),title(身高密度函数)subplot(1,2,2),plot(X,P),title(身高分布函数) 设正态二维分布的密度函数为: 作二维分布的散点图和直方图mu = 0 0;sigma = 1 0; 0 1;r = mvnrnd(mu,sigma,1000);subplot(1,2,1),plot(r(:,1),r(:,2),+)subplot(1,2,2),hist3(r,10 10) 对随机数发生器unifrnd产生的1000个随机数进行均值、方差、偏度和峰度等的参数的检验。偏
15、度计算方法为:u3=mean(R-R_mean)/R_std).3)*0.408248*sqrt(n);峰度计算方法为:uu=mean(R-0.5)/sqrt(1/12).4)-1.75u4=uu*0.204124*sqrt(n);function s1,s2,s3,s4=moment_test(R)% 对(0,1)均匀分布随机数进行矩检验n=length(R);R_mean=mean(R);R_var=var(R);R_std=std(R);u1=sqrt(12*n)*(R_mean-0.5);if abs(u1)1.96 s1=pass;else s1=*;end% 对方差进行检验var(R)u2=sqrt(180*n)*(R_var-1/12)if abs(u2)1.
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1