在用
Matlab绘制各种常用概率分布的密度函数时,都比较简单,唯独超几何分布试了几次都不成功,输出结果总是
2Hd6 mPh; ans =
MdKZH\z/ IaJ(T>"+ NaN
[v&_MQ ht-6_]+ME 查看了一下帮助 help hygepdf
(sl~n_<ds8 XR&*g1 HYGEPDF Hypergeometric probability density function.
9QYU
J mB
:lp=c` Y = HYGEPDF(X,M,K,N) returns the hypergeometric probability
4+~+`3;~v density function at X with integer parameters M, K, and N.
Y#m0/1- Note: The density function is zero unless X is an integer.
;L)}blN. #}gc6T~0 The size of Y is the common size of the input arguments. A scalar input
C6Mb(& functions as a constant matrix of the same size as the other inputs.
i a|F IW46-;l7 See also hygecdf, hygeinv, hygernd, hygestat, pdf.
HC0puLt_ ;F:(5GBi Reference page in Help browser
N,O[pTwj doc hygepdf
r({(; GphG/C ( 超几何分布参数较多,这里关于三个参数的指代不详。又在互联网上查了相关资料,包括该函数的定义式:
+X&B' #A/jGv^ http://ccpublic-1.central.cranfield.ac.uk/2001DMSOMFRC/pr062320/Matlab/stats/hygepdf.m x=Ru@n K; O{4m-; 直到发现这个例子后才清楚各个参数所代表的具体意义。
UFl*^j_)] "K@os< Suppose you have a lot of 100 floppy disks and you know that 20 of them are defective. What is the probability of drawing 0 through 5 defective floppy disks if you select 10 at random?
hb_Ia]b J?]W!V7C p = hygepdf(0:5,100,20,10)
3HA{18{4uP f+1]#"9i| p = 0.0951 0.2679 0.3182 0.2092 0.0841 0.0215
{P]l{W@li yJrPb" 详细可参见:
Ff,M~zn http://www.physnet.uni-hamburg.de/physnet/matlab/help/toolbox/stats/hygepdf.html#4257 }cP3i g7H;d 果然与一般对超几何分布公式字母惯常表示方式有所不同。尝试将上述分布作图如下
Rl)/[T B|%;(bM2C x = 0:5
S*]IR"YL p = hygepdf(x,100,20,10);
tsk}]@W plot(x,p,':k*')