poster
2019-12-10, 20:41
我想开发一个范围为[0.42,1.19]的对数正态分布,其少数元素指定为D=[1.19,1.00,0.84,0.71,0.59,0.50,0.42] 。平均值应为0.84 ,标准偏差应尽可能小。还给出了90%的cdf(=晶粒的90%)位于0.59 and 1.19之间。
一旦我知道了包含给定条件的对数正态分布的所有元素,便可以找到它所需要的pdf。这是我尝试过的简单步骤:
D=[1.19,1.00,0.84,0.71,0.59,0.50,0.42]; s=0.30; % std dev of the lognormal distribution m=0.84; % mean of the lognormal distribution mu=log(m^2/sqrt(s^2+m^2)); % mean of the associated normal dist. sigma=sqrt(log((s^2/m^2)+1)); % std dev of the associated normal dist. [r,c]=size(D); for i=1:c D_normal(i)=mu+(sigma.*randn(1)); w(i)=(D_normal(i)-mu)/sigma; % the probability or the wt. percentage end sizes=exp(D_normal);
回答:
如果您具有统计信息工具箱,并且想从对数正态分布中绘制随机值,则只需调用LOGNRND即可 (http://www.mathworks.com/access/helpdesk/help/toolbox/stats/lognrnd.html) 。如果您想知道具有给定平均值和特定值的sigma的对数正态分布的密度,请使用LOGNPDF (http://www.mathworks.com/access/helpdesk/help/toolbox/stats/lognpdf.html) 。
由于您正在计算重量,因此您可能正在寻找密度。在您的示例中,这些将是:
weights = lognpdf([1.19,1.00,0.84,0.71,0.59,0.50,0.42],0.84,0.3) weights = 0.095039 0.026385 0.005212 0.00079218 6.9197e-05 5.6697e-06 2.9244e-07 编辑
如果您想知道什么百分比的谷物落入0.59到1.19的范围内,请使用LOGNCDF (http://www.mathworks.com/access/helpdesk/help/toolbox/stats/logncdf.html) :
100*diff(logncdf([0.59,1.19],0.84,0.3)) ans = 1.3202 不是很多如果绘制分布图,您会发现对数值的对数正态分布峰值略高于2
x = 0:0.01:10; figure plot(x,lognpdf(x,0.84,0.3))
更多&回答... (https://stackoverflow.com/questions/3070183)
一旦我知道了包含给定条件的对数正态分布的所有元素,便可以找到它所需要的pdf。这是我尝试过的简单步骤:
D=[1.19,1.00,0.84,0.71,0.59,0.50,0.42]; s=0.30; % std dev of the lognormal distribution m=0.84; % mean of the lognormal distribution mu=log(m^2/sqrt(s^2+m^2)); % mean of the associated normal dist. sigma=sqrt(log((s^2/m^2)+1)); % std dev of the associated normal dist. [r,c]=size(D); for i=1:c D_normal(i)=mu+(sigma.*randn(1)); w(i)=(D_normal(i)-mu)/sigma; % the probability or the wt. percentage end sizes=exp(D_normal);
回答:
如果您具有统计信息工具箱,并且想从对数正态分布中绘制随机值,则只需调用LOGNRND即可 (http://www.mathworks.com/access/helpdesk/help/toolbox/stats/lognrnd.html) 。如果您想知道具有给定平均值和特定值的sigma的对数正态分布的密度,请使用LOGNPDF (http://www.mathworks.com/access/helpdesk/help/toolbox/stats/lognpdf.html) 。
由于您正在计算重量,因此您可能正在寻找密度。在您的示例中,这些将是:
weights = lognpdf([1.19,1.00,0.84,0.71,0.59,0.50,0.42],0.84,0.3) weights = 0.095039 0.026385 0.005212 0.00079218 6.9197e-05 5.6697e-06 2.9244e-07 编辑
如果您想知道什么百分比的谷物落入0.59到1.19的范围内,请使用LOGNCDF (http://www.mathworks.com/access/helpdesk/help/toolbox/stats/logncdf.html) :
100*diff(logncdf([0.59,1.19],0.84,0.3)) ans = 1.3202 不是很多如果绘制分布图,您会发现对数值的对数正态分布峰值略高于2
x = 0:0.01:10; figure plot(x,lognpdf(x,0.84,0.3))
更多&回答... (https://stackoverflow.com/questions/3070183)