nickyk的个人博客分享 http://blog.sciencenet.cn/u/nickyk

博文

MATLAB中,极值I型分布(Gumbel)的函数evpdf和evcdf要如何使用?

已有 19155 次阅读 2011-8-1 15:40 |个人分类:学位论文|系统分类:科研笔记| MATLAB, gumbel, evpdf, evcdf, 极值I型分布

书上题目: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种方法结果不一样,不知道这个函数哪里用错了。

 

下面是matlab的help文件中对evcdf和evpdf的介绍:
evcdf

Extreme value cumulative distribution function

Syntax

P = evcdf(X,mu,sigma)
[P,PLO,PUP] = evcdf(X,mu,sigma,pcov,alpha)

Description

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.

evpdf

Extreme value probability density function

Syntax

Y = evpdf(X,mu,sigma)

Description

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函数的源码看看。

 

源码我不懂打开看,所以还是按照定义来计算好了。软件等计算工具确实十分方便,但是使用的时候还是要用对,最好是找一些书上的例子对照一下结果。不要为了图方便而计算出了错误的结果,任何时候正确才是第一位的。



https://wap.sciencenet.cn/blog-577249-470671.html

上一篇:关于对数正态分布logncdf和lognpdf参数的取值。
下一篇:学习《结构可靠度》<Reliability of Structures>
收藏 IP: 222.247.53.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (1 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-19 02:02

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部