Main Content

mean

概率分布的均值

说明

示例

m = mean(pd) 返回概率分布 pd 的均值 m

示例

全部折叠

加载样本数据。创建包含学生考试成绩数据的第一列的向量。

load examgrades
x = grades(:,1);

通过对数据进行正态分布拟合来创建正态分布对象。

pd = fitdist(x,'Normal')
pd = 
  NormalDistribution

  Normal distribution
       mu = 75.0083   [73.4321, 76.5846]
    sigma =  8.7202   [7.7391, 9.98843]

分布对象的输出包括均值 (mu) 和标准差 (sigma) 的参数估计值,以及每个参数的 95% 置信区间。

计算拟合分布的均值。

m = mean(pd)
m = 75.0083

正态分布的均值不等于参数 mu

创建威布尔概率分布对象。

pd = makedist('Weibull','A',5,'B',2)
pd = 
  WeibullDistribution

  Weibull distribution
    A = 5
    B = 2

计算分布的均值。

mean = mean(pd)
mean = 4.4311

创建均匀分布对象。

pd = makedist('Uniform','lower',-3,'upper',5)
pd = 
  UniformDistribution

  Uniform distribution
    Lower = -3
    Upper =  5

计算分布的均值。

m = mean(pd)
m = 1

加载样本数据。通过对每加仑英里数 (MPG) 数据进行核分布拟合来创建一个概率分布对象。

load carsmall;
pd = fitdist(MPG,'Kernel')
pd = 
  KernelDistribution

    Kernel = normal
    Bandwidth = 4.11428
    Support = unbounded

计算分布的均值。

mean(pd)
ans = 23.7181

输入参数

全部折叠

概率分布,指定为下表中的概率分布对象之一。

分布对象用于创建概率分布对象的函数或 App
BetaDistributionmakedistfitdist分布拟合器
BinomialDistributionmakedistfitdist分布拟合器
BirnbaumSaundersDistributionmakedistfitdist分布拟合器
BurrDistributionmakedistfitdist分布拟合器
ExponentialDistributionmakedistfitdist分布拟合器
ExtremeValueDistributionmakedistfitdist分布拟合器
GammaDistributionmakedistfitdist分布拟合器
GeneralizedExtremeValueDistributionmakedistfitdist分布拟合器
GeneralizedParetoDistributionmakedistfitdist分布拟合器
HalfNormalDistributionmakedistfitdist分布拟合器
InverseGaussianDistributionmakedistfitdist分布拟合器
KernelDistributionfitdist分布拟合器
LogisticDistributionmakedistfitdist分布拟合器
LoglogisticDistributionmakedistfitdist分布拟合器
LognormalDistributionmakedistfitdist分布拟合器
LoguniformDistributionmakedist
MultinomialDistributionmakedist
NakagamiDistributionmakedistfitdist分布拟合器
NegativeBinomialDistributionmakedistfitdist分布拟合器
NormalDistributionmakedistfitdist分布拟合器
PiecewiseLinearDistributionmakedist
PoissonDistributionmakedistfitdist分布拟合器
RayleighDistributionmakedistfitdist分布拟合器
RicianDistributionmakedistfitdist分布拟合器
StableDistributionmakedistfitdist分布拟合器
tLocationScaleDistributionmakedistfitdist分布拟合器
TriangularDistributionmakedist
UniformDistributionmakedist
WeibullDistributionmakedistfitdist分布拟合器

输出参数

全部折叠

概率分布的均值,以标量值形式返回。

扩展功能

版本历史记录

在 R2013a 中推出