主要内容

cdf

Cumulative distribution function

描述

y= cdf(name,x,A)returns the cumulative distribution function (cdf) for the one-parameter distribution family specified bynameand the distribution parameterA, evaluated at the values inx.

example

y= cdf(name,x,A,B)returns the cdf for the two-parameter distribution family specified bynameand the distribution parametersAandB, evaluated at the values inx.

y= cdf(name,x,A,B,C)返回由指定的三参数分销家族的CDFnameand the distribution parametersA,B, andC, evaluated at the values inx.

y= cdf(name,x,A,B,C,D)returns the cdf for the four-parameter distribution family specified bynameand the distribution parametersA,B,C, andD, evaluated at the values inx.

example

y= cdf(pd,x)返回概率分布对象的CDFpd, evaluated at the values inx.

y = cdf(___,'upper')returns the complement of the cdf using an algorithm that more accurately computes the extreme upper-tail probabilities.'上'can follow any of the input arguments in the previous syntaxes.

例子

collapse all

Compute the cdf values for a normal distribution by specifying the distribution name'Normal'and the distribution parameters.

Define the input vectorxto contain the values at which to calculate the cdf.

x = [-2,-1,0,1,2];

计算平均值的正态分布的CDF值 μ 等于1和标准偏差 σ 等于5。

mu = 1; sigma = 5; y = cdf('Normal',x,mu,sigma)
y =1×50.2743 0.3446 0.4207 0.5000 0.5793

每个值INycorresponds to a value in the input vectorx. For example, at the valuexequal to 1, the corresponding cdf valueyis equal to 0.5000.

创建正态分布对象,并使用对象计算正态分布的CDF值。

Create a normal distribution object with the mean μ 等于1和标准偏差 σ 等于5。

mu = 1; sigma = 5; pd = makedist('Normal','mu',亩,'sigma',Sigma);

Define the input vectorxto contain the values at which to calculate the cdf.

x = [-2,-1,0,1,2];

Compute the cdf values for the normal distribution at the values inx.

y = cdf(pd,x)
y =1×50.2743 0.3446 0.4207 0.5000 0.5793

每个值INycorresponds to a value in the input vectorx. For example, at the valuexequal to 1, the corresponding cdf valueyis equal to 0.5000.

Create a Poisson distribution object with the rate parameter, λ , equal to 2.

lambda = 2;PD = Makedist(“泊松”,'lambda',lambda);

Define the input vectorxto contain the values at which to calculate the cdf.

x = [0,1,2,3,4];

Compute the cdf values for the Poisson distribution at the values inx.

y = cdf(pd,x)
y =1×50.1353 0.4060 0.6767 0.8571 0.9473

每个值INycorresponds to a value in the input vectorx. For example, at the valuexequal to 3, the corresponding cdf valueyis equal to 0.8571.

另外,您可以计算相同的CDF值,而无需创建概率分发对象。使用cdffunction, and specify a Poisson distribution using the same value for the rate parameter, λ .

y2 = cdf(“泊松”,x,lambda)
y2 =1×50.1353 0.4060 0.6767 0.8571 0.9473

CDF值与使用概率分布对象计算的值相同。

创建标准的正态分布对象。

PD = Makedist('Normal')
pd = NormalDistribution Normal distribution mu = 0 sigma = 1

Specify thexvalues and compute the cdf.

x = -3:.1:3; p = cdf(pd,x);

Plot the cdf of the standard normal distribution.

plot(x,p)

Figure contains an axes object. The axes object contains an object of type line.

创建三个伽马分配对象。第一个使用默认参数值。第二个指定a = 1andb = 2. The third specifiesa = 2andb = 1.

pd_gamma = makedist('Gamma')
pd_gamma = GammaDistribution Gamma distribution a = 1 b = 1
pd_12 = makedist('Gamma','a',1,'b',2)
pd_12 = GammaDistribution Gamma distribution a = 1 b = 2
pd_21 = makedist('Gamma','a',2,'b',1)
pd_21 = GammaDistribution Gamma distribution a = 2 b = 1

Specify thexvalues and compute the cdf for each distribution.

x = 0:.1:5;cdf_gamma = cdf(pd_gamma,x);CDF_12 = CDF(PD_12,X);CDF_21 = CDF(PD_21,X);

Create a plot to visualize how the cdf of the gamma distribution changes when you specify different values for the shape parametersaandb.

figure; J = plot(x,cdf_gamma); holdon;k =图(x,cdf_12,'r-'); L = plot(x,cdf_21,'k-.'); set(J,'行宽',2);set(k,'行宽',2);传奇([J k l],'a = 1, b = 1','a = 1, b = 2','a = 2, b = 1','Location','东南'); holdoff;

Figure contains an axes object. The axes object contains 3 objects of type line. These objects represent a = 1, b = 1, a = 1, b = 2, a = 2, b = 1.

Fit Pareto tails to a t distribution at cumulative probabilities 0.1 and 0.9.

t = trnd(3,100,1); obj = paretotails(t,0.1,0.9); [p,q] = boundary(obj)
p =2×10.1000 0.9000
q =2×1-1.8487 2.0766

Compute the cdf at the values inq.

cdf(obj,q)
ans =2×10.1000 0.9000

Input Arguments

collapse all

Probability distribution name, specified as one of the probability distribution names in this table.

name Distribution Input ParameterA Input ParameterB Input ParameterC Input ParameterD
'Beta' Beta Distribution afirst shape parameter bsecond shape parameter N/A N/A
'Binomial' Binomial Distribution nnumber of trials p每个试验成功的概率 N/A N/A
'Birnbaumsaunders' Birnbaum-Saunders Distribution βscale parameter γshape parameter N/A N/A
'Burr' Burr型XII分布 αscale parameter cfirst shape parameter ksecond shape parameter N/A
'Chisquare'or'chi2' Chi-Square Distribution νdegrees of freedom N/A N/A N/A
'Exponential' 指数分布 μ意思是 N/A N/A N/A
'Extreme Value'or'ev' Extreme Value Distribution μlocation parameter σscale parameter N/A N/A
'F' F Distribution ν1分子自由度 ν2denominator degrees of freedom N/A N/A
'Gamma' Gamma Distribution ashape parameter bscale parameter N/A N/A
'Generalized Extreme Value'or'gev' 广义的极值分布 kshape parameter σscale parameter μlocation parameter N/A
'Generalized Pareto'or'gp' Generalized Pareto Distribution ktail index (shape) parameter σscale parameter μthreshold (location) parameter N/A
'Geometric' Geometric Distribution p概率参数 N/A N/A N/A
'Half Normal'or'hn' 半正常分布 μlocation parameter σscale parameter N/A N/A
'Hypergeometric'or'hyge' Hypergeometric Distribution m人口的规模 k人口中所需特征的项目数量 nnumber of samples drawn N/A
'InverseGaussian' Inverse Gaussian Distribution μscale parameter λshape parameter N/A N/A
'Logistic' Logistic Distribution μ意思是 σscale parameter N/A N/A
'LogLogistic' 日志分布 μ意思是of logarithmic values σ对数值的比例参数 N/A N/A
'LogNormal' Lognormal Distribution μ意思是of logarithmic values σ对数值的标准偏差 N/A N/A
'Loguniform' 徽标分布 a较低端点(最小值) bupper endpoint (maximum) N/A N/A
'Nakagami' Nakagami Distribution μshape parameter ωscale parameter N/A N/A
'Negative Binomial'or'nbin' Negative Binomial Distribution r成功的数量 pprobability of success in a single trial N/A N/A
“非中心f”or'ncf' Noncentral F Distribution ν1分子自由度 ν2denominator degrees of freedom δnoncentrality parameter N/A
'Noncentral t'or'nct' Noncentral t Distribution νdegrees of freedom δnoncentrality parameter N/A N/A
'Noncentral Chi-square'or'ncx2' 非中心卡方分布 νdegrees of freedom δnoncentrality parameter N/A N/A
'Normal' Normal Distribution μ意思是 σstandard deviation N/A N/A
“泊松” Poisson Distribution λ意思是 N/A N/A N/A
'瑞利' Rayleigh Distribution bscale parameter N/A N/A N/A
'Rician' Rician Distribution snoncentrality parameter σscale parameter N/A N/A
'稳定的' Stable Distribution αfirst shape parameter βsecond shape parameter γscale parameter δlocation parameter
'T' 学生的t分布 νdegrees of freedom N/A N/A N/A
'tLocationScale' t Location-Scale Distribution μlocation parameter σscale parameter νshape parameter N/A
'Uniform' Uniform Distribution (Continuous) a较低端点(最小值) bupper endpoint (maximum) N/A N/A
'Discrete Uniform'or'unid' Uniform Distribution (Discrete) n最大可观察值 N/A N/A N/A
'weibull'or'wbl' Weibull Distribution ascale parameter bshape parameter N/A N/A

例子:'Normal'

评估CDF的值,指定为标量值或标量值数组。

If one or more of the input argumentsx,A,B,C, andDare arrays, then the array sizes must be the same. In this case,cdfexpands each scalar input into a constant array of the same size as the array inputs. Seenamefor the definitions ofA,B,C, andD对于每个分布。

例子:[0.1,0.25,0.5,0.75,0.9]

数据类型:single|双倍的

第一个概率分布参数, specified as a scalar value or an array of scalar values.

If one or more of the input argumentsx,A,B,C, andDare arrays, then the array sizes must be the same. In this case,cdfexpands each scalar input into a constant array of the same size as the array inputs. Seenamefor the definitions ofA,B,C, andD对于每个分布。

数据类型:single|双倍的

第二概率分布参数, specified as a scalar value or an array of scalar values.

If one or more of the input argumentsx,A,B,C, andDare arrays, then the array sizes must be the same. In this case,cdfexpands each scalar input into a constant array of the same size as the array inputs. Seenamefor the definitions ofA,B,C, andD对于每个分布。

数据类型:single|双倍的

第三概率分布参数,指定为标量值或标量值数组。

If one or more of the input argumentsx,A,B,C, andDare arrays, then the array sizes must be the same. In this case,cdfexpands each scalar input into a constant array of the same size as the array inputs. Seenamefor the definitions ofA,B,C, andD对于每个分布。

数据类型:single|双倍的

第四概率分布参数, specified as a scalar value or an array of scalar values.

If one or more of the input argumentsx,A,B,C, andDare arrays, then the array sizes must be the same. In this case,cdfexpands each scalar input into a constant array of the same size as the array inputs. Seenamefor the definitions ofA,B,C, andD对于每个分布。

数据类型:single|双倍的

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

Distribution Object Function or App to Create Probability Distribution Object
BetaDistribution makedist,fitdist,Distribution Fitter
二项分布 makedist,fitdist,Distribution Fitter
BirnbaumSaundersDistribution makedist,fitdist,Distribution Fitter
伯德分布 makedist,fitdist,Distribution Fitter
ExponentialDistribution makedist,fitdist,Distribution Fitter
ExtremeValueDistribution makedist,fitdist,Distribution Fitter
伽马分布 makedist,fitdist,Distribution Fitter
GeneralizedExtremeValueDistribution makedist,fitdist,Distribution Fitter
GeneralizedParetoDistribution makedist,fitdist,Distribution Fitter
半normaldistribution makedist,fitdist,Distribution Fitter
Inversegaussiandistripution makedist,fitdist,Distribution Fitter
kerneldistribution fitdist,Distribution Fitter
LogisticDistribution makedist,fitdist,Distribution Fitter
LogLogisticDistribution makedist,fitdist,Distribution Fitter
LognormalDistribution makedist,fitdist,Distribution Fitter
loguniformdistripution makedist
MultinomialDistribution makedist
NakagamiDistribution makedist,fitdist,Distribution Fitter
NegativeBinomialDistribution makedist,fitdist,Distribution Fitter
NormalDistribution makedist,fitdist,Distribution Fitter
Piecewise distribution with generalized Pareto distributions in the tails paretotails
分段分布 makedist
PoissonDistribution makedist,fitdist,Distribution Fitter
雷利德分布 makedist,fitdist,Distribution Fitter
RicianDistribution makedist,fitdist,Distribution Fitter
StableDistribution makedist,fitdist,Distribution Fitter
tLocationScaleDistribution makedist,fitdist,Distribution Fitter
三角分裂 makedist
UniformDistribution makedist
weibulldistribution makedist,fitdist,Distribution Fitter

Output Arguments

collapse all

CDF值,返回为标量值或标量值数组。y大小与xafter any necessary scalar expansion. Each element inyis the cdf value of the distribution, specified by the corresponding elements in the distribution parameters (A,B,C, andD) or the probability distribution object (pd), evaluated at the corresponding element inx.

Alternative Functionality

  • cdfis a generic function that accepts either a distribution by its namename或概率分配对象pd. It is faster to use a distribution-specific function, such asnormcdf对于正态分布和Binocdf二项分布。的分配ibution-specific functions, seeSupported Distributions.

  • 使用Probability Distribution Functionapp to create an interactive plot of the cumulative distribution function (cdf) or probability density function (pdf) for a probability distribution.

Extended Capabilities

Version History

Introduced before R2006a