2011-10-12 117 views
2

我寻找以下MATLAB函数在数学等价的:随机泊松噪声

“R = poissrnd(拉姆达)从与平均参数的λ的泊松分布产生随机数的λ可以是一个矢量。矩阵或多维数组,R的大小是lambda的大小。“

下面的函数输出示例。

b = 95.7165 95.7165 95.7165 95.7165 95.7165 98.9772 98.9772 98.9772 98.9772 0.3876 

poissrnd(b) 

ans =100 115  81 90 109 106 104 87 104  2 

我怎么能在Mathematica 8中做类似的事情?

回答

8

Poisson distribution仅用于整数。所以你需要使用RandomIntegerPoissonDistribution像这样:

poissrnd[lambda_]:=RandomInteger[PoissonDistribution[lambda]] 

用法:

b = {95.7165, 95.7165, 95.7165, 95.7165, 95.7165, 98.9772, 98.9772, 
    98.9772, 98.9772, 0.3876}; 

poissrnd /@ b 

Out[1] = {104, 97, 67, 84, 96, 123, 93, 96, 100, 0} 
4

通过阅读大量的在线Mathematica文档,特别是关于PoissonDistribution及其绘图示例,它指向PDF。这将允许您计算分配值。

请注意,根据我个人的经验,对于简单的发行版,只需插入发行版的公式并使用它即可,而不是花哨的PDF方法。泊松分布不是太复杂。

3

或者,你可以使用

In[2]:= lambda = {1.0, 2.05, 11.04} 

Out[2]= {1., 2.05, 11.04} 

In[3]:= Map[RandomVariate[PoissonDistribution[#]] &, lambda] 

Out[3]= {0, 3, 11}