最近在写论文的过程中,利用RFV(随机模糊变量)表示传感器的不确定性,需要求一组数据均值和标准差,在matlab中找到了normfit函数,具体的使用的方法以及语法如下.
normfit:
Normal parameter estimates
normfit
函数的语法:
[muHat,sigmaHat] = normfit(x)
x
:输入的数据
muHat
:表示正态分布中均值μ的估计值;
sigmaHat
:表示正态分布中标准偏差σ的估计值;
[muhat,sigmahat,muci,sigmaci] = normfit(x)
各个参数的具体含义如下:
x
:输入的数据
muhat
:表示正态分布中均值μ的估计值;
sigmahat
:表示正态分布中标准偏差σ的估计值;
muci
:为置信区间;
sigmaci
:为置信区间对应的置信度.
[muHat,sigmaHat,muCI,sigmaCI] = normfit(x,alpha)
[muHat,sigmaHat,muCI,sigmaCI] = normfit(x,alpha) specifies the confidence level for the confidence intervals to be 100(1–alpha)%.via 官方文档
alpha
:指定置信度(1-alpha)的置信区间
下面举一个例子(官方文档中的例子):
rng('default') % For reproducibility
x = normrnd(3,5,[1000,1]);
% Find the parameter estimates and the 99% confidence intervals.
[muHat,sigmaHat,muCI,sigmaCI] = normfit(x,0.01)
输出的结果:
muHat = 2.8368
sigmaHat = 4.9948
muCI = 2×1
2.4292
3.2445
sigmaCI = 2×1
4.7218
5.2989
muHat
is the sample mean, and sigmaHat
is the square root of the unbiased estimator of the variance. muCI
and sigmaCI
are the 99% confidence intervals of the mean and standard deviation parameters. The first row is the lower bound, and the second row is the upper bound.