打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
normfit和normpdf用法

使用方法:
[muhat, sigmahat] = normfit(data)
[muhat, sigmahat, muci, sigmaci] = normfit(data)
[muhat, sigmahat, muci, sigmaci] = normfit(data, alpha)
[...] = normfit(data, alpha, censoring)
[...] = normfit(data, alpha, censoring, freq)
[...] = normfit(data, alpha, censoring, freq, options)

说明:
[muhat, sigmahat] = normfit(data) 返回给定数据data的正态分布均值μ 和标准差σ的参数估计。
[muhat, sigmahat, muci, sigmaci] = normfit(data, alpha)返回置信度区间为100(1 - alpha) % 的参数估计,这里alpha 是一个[01]范围内的值,由置信区间宽度决定。默认alpha 是0.05,对应95%的置信度区间。

=================================================================================================

matlab中normfit在正态分布中的使用技巧如下:

函数 normfit
格式 [muhat,sigmahat,muci,sigmaci] = normfit(X)
[muhat,sigmahat,muci,sigmaci] = normfit(X,alpha)
说明muhat,sigmahat分别为正态分布的参数μ和σ的估计值,muci,sigmaci分别为置信区间,其置信度为;alpha给出显著水平α,缺省时默认为0.05,即置信度为95%.
例4-62 有两组(每组100个元素)正态随机数据,其均值为10,均方差为2,求95%的置信区间和参数估计值.
解:>>r = normrnd (10,2,100,2);%产生两列正态随机数据
>>[mu,sigma,muci,sigmaci] =normfit(r)
则结果为
mu =
10.1455 10.0527 %各列的均值的估计值
sigma =
1.9072 2.1256 %各列的均方差的估计值
muci =
9.7652 9.6288
10.5258 10.4766
sigmaci =
1.6745 1.8663
2.2155 2.4693
说明 muci,sigmaci中各列分别为原随机数据各列估计值的置信区间,置信度为95%.
例4-63 分别使用金球和铂球测定引力常数
(1)用金球测定观察值为:6.683 6.681 6.676 6.678 6.679 6.672
(2)用铂球测定观察值为:6.661 6.661 6.667 6.667 6.664
设测定值总体为,μ和σ为未知.对(1),(2)两种情况分别求μ和σ的置信度为0.9的置信区间.
解:建立M文件:LX0833.m
X=[6.683 6.681 6.676 6.678 6.679 6.672];
Y=[6.661 6.661 6.667 6.667 6.664];
[mu,sigma,muci,sigmaci]=normfit(X,0.1) %金球测定的估计
[MU,SIGMA,MUCI,SIGMACI]=normfit(Y,0.1) %铂球测定的估计
运行后结果显示如下:
mu =
6.6782
sigma =
0.0039
muci =
6.6750
6.6813
sigmaci =
0.0026
0.0081
MU =
6.6640
SIGMA =
0.0030
MUCI =
6.6611
6.6669
SIGMACI =
0.0019
0.0071
由上可知,金球测定的μ估计值为6.6782,置信区间为[6.6750,6.6813];
σ的估计值为0.0039,置信区间为[0.0026,0.0081].
泊球测定的μ估计值为6.6640,置信区间为[6.6611,6.6669];
σ的估计值为0.0030,置信区间为[0.0019,0.0071].

=============================================================================================== 

而normpdf是求概率密度函数

normpdf - Normal probability densityfunction

Syntax

Y = normpdf(X,mu,sigma)
Y = normpdf(X)
Y = normpdf(X,mu)

Description

Y =normpdf(X,mu,sigma) computes the pdf at each of the values inX using the normal distribution with mean mu andstandard deviation sigma. X, mu, andsigma can be vectors, matrices, or multidimensional arraysthat all have the same size. A scalar input is expanded to aconstant array with the same dimensions as the other inputs. Theparameters in sigma must be positive.

The normal pdf is

The likelihood function is the pdf viewedas a function of the parameters. Maximum likelihood estimators(MLEs) are the values of the parameters that maximize thelikelihood function for a fixed value of x.

The standard normal distribution hasμ = 0 and σ = 1.

If x is standard normal, thenxσ + μ is also normal with meanμ and standard deviation σ. Conversely, ify is normal with mean μ and standarddeviation σ, then x =(y-μσis standard normal.

Y = normpdf(X) uses the standard normal distribution(mu 0,sigma 1).

Y = normpdf(X,mu) uses the normal distribution withunit standard deviation(sigma 1).

Examples

mu = [0:0.1:2];[y i] = max(normpdf(1.5,mu,1));MLE = mu(i)MLE =  1.5000
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
matlab中normfit在正态分布中的使用技巧
Matlab概率统计工具箱(2)最常用
Matlab实现正态分布
统计学中常见的概率密度图像
轻松理解卡尔曼滤波
MATLAB各种概率分布画图(转载)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服