主要内容

本页翻译不是最新的。点击此处可查看最新英文版本。

mean

R2025b

概率分布的均值

描述

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
BetaDistributionmakedist、fitdist、分布拟合器
BinomialDistributionmakedist、fitdist、分布拟合器
BirnbaumSaundersDistributionmakedist、fitdist、分布拟合器
BurrDistributionmakedist、fitdist、分布拟合器
EmpiricalDistributionfitdist
ExponentialDistributionmakedist、fitdist、分布拟合器
ExtremeValueDistributionmakedist、fitdist、分布拟合器
GammaDistributionmakedist、fitdist、分布拟合器
GeneralizedExtremeValueDistributionmakedist、fitdist、分布拟合器
GeneralizedParetoDistributionmakedist、fitdist、分布拟合器
HalfNormalDistributionmakedist、fitdist、分布拟合器
InverseGaussianDistributionmakedist、fitdist、分布拟合器
KernelDistributionfitdist、分布拟合器
LogisticDistributionmakedist、fitdist、分布拟合器
LoglogisticDistributionmakedist、fitdist、分布拟合器
LognormalDistributionmakedist、fitdist、分布拟合器
LoguniformDistributionmakedist
MultinomialDistributionmakedist
NakagamiDistributionmakedist、fitdist、分布拟合器
NegativeBinomialDistributionmakedist、fitdist、分布拟合器
NormalDistributionmakedist、fitdist、分布拟合器
PearsonDistributionmakedist
PiecewiseLinearDistributionmakedist
PoissonDistributionmakedist、fitdist、分布拟合器
RayleighDistributionmakedist、fitdist、分布拟合器
RicianDistributionmakedist、fitdist、分布拟合器
StableDistributionmakedist、fitdist、分布拟合器
tLocationScaleDistributionmakedist、fitdist、分布拟合器
TriangularDistributionmakedist
UniformDistributionmakedist
WeibullDistributionmakedist、fitdist、分布拟合器

输出参量

全部折叠

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

扩展功能

全部展开

版本历史记录

在 R2013a 中推出