|||
书上题目:The variable Q follows an extreme Type I distribution with mu=100 and sigma=12.
Calculate FQ(150) and fQ(150).
书上答案是:FQ(150)=0.997 fQ(150)=2.86e-4.
我用MATLAB计算:
>> evpdf(150,100,12)
ans =
5.2281e-028
>> evcdf(150,100,12)
ans =
1
pdf的计算结果与书上的相差甚远。
为了看书上的方法和直接使用evpdf、evcdf的方法的不同,我编了如下程序:
%% 查看2种方法的不同结果
clc;
clear;
mu=100;sigma=12;xstar=100;%输入不同的分布参数和验算点,分别查看结果
%% 使用MATLAB自带的函数编程
evcdf(xstar,mu,sigma)
evpdf(xstar,mu,sigma)
%% 按照Nowak书中介绍的方法编程
a=sqrt(pi^2/6/sigma^2);
u=mu-0.5772/a;
Fx=exp(-exp(-a*(xstar-u)))
fx=a*(exp(-a*(xstar-u)))*exp(-exp(-a*(xstar-u)))
结论是2种方法结果不一样,不知道这个函数哪里用错了。
Extreme value cumulative distribution function
P = evcdf(X,mu,sigma)
[P,PLO,PUP] = evcdf(X,mu,sigma,pcov,alpha)
P = evcdf(X,mu,sigma) computes the cumulative distribution function (cdf) for the type 1 extreme value distribution, with location parameter mu and scale parameter sigma, at each of the values in X. X, mu, and sigma can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input is expanded to a constant array of the same size as the other inputs. The default values for mu and sigma are 0 and 1, respectively.
Extreme value probability density function
Y = evpdf(X,mu,sigma)
Y = evpdf(X,mu,sigma) returns the pdf of the type 1 extreme value distribution with location parameter mu and scale parameter sigma, evaluated at the values in X. X, mu, and sigma can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input is expanded to a constant array of the same size as the other inputs. The default values for mu and sigma are 0 and 1, respectively.
The type 1 extreme value distribution is also known as the Gumbel distribution. If x has a Weibull distribution, then X = log(x) has the type 1 extreme value distribution.
可能是我对这英文没太理解,with location parameter mu and scale parameter sigma。
我在ilovematlab论文问了谢中华老师,他的回复如下:
evpdf(xstar,mu,sigma)中的mu不是其均值,sigma也不是其标准差,你可以打开evstat函数的源码看看。
源码我不懂打开看,所以还是按照定义来计算好了。软件等计算工具确实十分方便,但是使用的时候还是要用对,最好是找一些书上的例子对照一下结果。不要为了图方便而计算出了错误的结果,任何时候正确才是第一位的。
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-7-28 00:32
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社