var
概率分布的差异
Syntax
Description
Examples
Variance of a Fitted Distribution
加载样本数据。创建一个包含学生考试成绩数据的第一列的向量。
load考试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]
Compute the variance of the fitted distribution.
v = var(pd)
V = 76.0419
For a normal distribution, the variance is equal to the square of the parametersigma
.
Variance of a Skewed Distribution
Create a Weibull probability distribution object.
PD= makedist('weibull','a',5,'b',2)
pd = weibulldistribution weibull分布a = 5 b = 2
计算分布的方差。
v = var(pd)
v = 5.3650
Variance of a Triangular Distribution
Create a triangular distribution object.
PD= makedist('Triangular','a',-3,'b',1,'c',3)
PD= TriangularDistribution A = -3, B = 1, C = 3
计算分布的方差。
v = var(pd)
v = 1.5556
Variance of a Kernel Distribution
加载样本数据。Create a vector containing the first column of students’ exam grade data.
load考试; x = grades(:,1);
Fit a kernel distribution object to the data.
PD= fitdist(x,'Kernel')
PD= KernelDistribution Kernel = normal Bandwidth = 3.61677 Support = unbounded
Compute the variance of the fitted distribution.
v = var(pd)
v = 88.4893
Input Arguments
PD
—Probability distribution
概率分配对象
Probability distribution, specified as a probability distribution object created using one of the following.
Function or App | Description |
---|---|
makedist |
Create a probability distribution object using specified parameter values. |
fitdist |
Fit a probability distribution object to sample data. |
Distribution Fitter | 使用交互式分配钳工应用程序将概率分布拟合到示例数据,并将拟合的对象导出到工作区。 |
Output Arguments
v
— Variance
nonnegative scalar value
Variance of the probability distribution, returned as a nonnegative scalar value.
Extended Capabilities
C/C++ Code Generation
使用MATLAB®CODER™生成C和C ++代码。
Usage notes and limitations:
The input argument
PD
can be a fitted probability distribution object for beta, exponential, extreme value, lognormal, normal, and Weibull distributions. CreatePD
by fitting a probability distribution to sample data from thefitdist
function. For an example, see代码生成概率分布对象.
For more information on code generation, seeIntroduction to Code Generation和General Code Generation Workflow.
See Also
Open Example
A modified version of this example exists on your system. Do you want to open this version instead?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
您还可以从以下列表中选择一个网站:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- AméricaLatina(Español)
- Canada(English)
- United States(English)
欧洲
- Belgium(English)
- 丹麦(English)
- Deutschland(德意志)
- España(Español)
- Finland(English)
- 法国(Français)
- 爱尔兰(English)
- Italia(Italiano)
- Luxembourg(English)
- Netherlands(English)
- 挪威(English)
- Österreich(德意志)
- Portugal(English)
- Sweden(English)
- Switzerland
- United Kingdom(English)