主要内容

truncate

Truncate probability distribution object

描述

example

t= truncate(PD,lower,upper)返回概率分布t, which is the probability distributionPD将下限截断为指定间隔,lower, and upper limit,upper.

Examples

collapse all

创造a standard normal probability distribution object.

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

Truncate the distribution to have a lower limit of -2 and an upper limit of 2.

t = truncate(pd,-2,2)
t =正常分布分布mu = 0 sigma = 1截断为间隔[-2,2]

Plot the pdf of the original and truncated distributions for a visual comparison.

x = linspace(-3,3,1000); figure plot(x,pdf(pd,x)) holdplot(x,pdf(t,x),'linestyle','--') legend('Normal','Truncated') 抓住离开

创造a standard normal probability distribution object.

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

Truncate the distribution by restricting it to positive values. Set the lower limit to 0 and the upper limit to infinity.

t = truncate(pd,0,inf)
t = NormalDistribution Normal distribution mu = 0 sigma = 1 Truncated to the interval [0, Inf]

Generate random numbers from the truncated distribution and visualize with a histogram.

r = random(t,10000,1); histogram(r,100)

Input Arguments

collapse all

Probability distribution, specified as a probability distribution object.

创造a probability distribution object with specified parameter values usingmakedist.

Alternatively, for a fittable distribution, create a probability distribution object by fitting it to data usingfitdist或者Distribution Fitter应用程序。

较低的截断极限,指定为标量值。

Data Types:single|double

上部截断极限,指定为标量值。

Data Types:single|double

Output Arguments

collapse all

Truncated distribution, returned as a probability distribution object. The probability distribution function (pdf) oftis 0 outside the truncation interval. Inside the truncation interval, the pdf oftis equal to the pdf ofPD, but divided by the probability assigned to that interval byPD.

The object properties oft与那些相同PDwith these exceptions:

  • TheTruncationproperty oftstores the truncation interval.

  • TheIsTruncatedproperty oftis 1.

  • The输入数据property oft是空的。对于拟合的分销对象,输入数据属性存储用于分发拟合的数据。截断的分布对象不会存储输入数据。

Extended Capabilities

在R2013a中引入