在matlab中随机生成固定的非高斯分布中的数字

时间:2013-07-01 15:35:29

标签: matlab random matrix generator permutation

我有一个200 x 200的数据矩阵(关于x = y对称),其中矩阵中每个值的位置很重要。矩阵填充的值介于-0.2和0.8之间,非正态分布。

我试图从这些中生成一个随机模型来测试我通过对200 x 200矩阵中的值进行某些操作得到的结果变量是否显着。我认为最好的方法是定义值的分布,然后从这些中创建一个随机矩阵。我认为这可能比随机置换矩阵上三角形中的值(更快)更好?有人知道怎么做吗?我将需要对具有不同非高斯分布的数千个矩阵重复这一点,因此快速解决方案将受到赞赏!谢谢!

1 个答案:

答案 0 :(得分:0)

完全确切地确切地询问了什么,但我想您可以查看统计工具箱中的random()函数:

>> help random
  

RANDOM从指定的分布生成随机数组。       R = RANDOM(NAME,A)返回从中选择的随机数组       NAME用参数指定的单参数概率分布       价值A。

R = RANDOM(NAME,A,B) or R = RANDOM(NAME,A,B,C) returns an array of random
numbers chosen from a two- or three-parameter probability distribution
with parameter values A, B (and C).

The size of R is the common size of the input arguments.  A scalar input
functions as a constant matrix of the same size as the other inputs.

R = RANDOM(NAME,A,M,N,...) or R = RANDOM(NAME,A,[M,N,...]) returns an
M-by-N-by-... array of random numbers for a one-parameter distribution.
Similarly, R = RANDOM(NAME,A,B,M,N,...) or R = RANDOM(NAME,A,B,[M,N,...]),
and R = RANDOM(NAME,A,B,C,M,N,...) or R = RANDOM(NAME,A,B,C,[M,N,...]),
return an M-by-N-by-... array of random numbers for a two- or
three-parameter distribution.


NAME can be:

   'beta'  or 'Beta',
   'bino'  or 'Binomial',
   'chi2'  or 'Chisquare',
   'exp'   or 'Exponential',
   'ev'    or 'Extreme Value',
   'f'     or 'F',
   'gam'   or 'Gamma',
   'gev'   or 'Generalized Extreme Value',
   'gp'    or 'Generalized Pareto',
   'geo'   or 'Geometric',
   'hyge'  or 'Hypergeometric',
   'logn'  or 'Lognormal',
   'nbin'  or 'Negative Binomial',
   'ncf'   or 'Noncentral F',
   'nct'   or 'Noncentral t',
   'ncx2'  or 'Noncentral Chi-square',
   'norm'  or 'Normal',
   'poiss' or 'Poisson',
   'rayl'  or 'Rayleigh',
   't'     or 'T',
   'unif'  or 'Uniform',
   'unid'  or 'Discrete Uniform',
   'wbl'   or 'Weibull'.
     

- 剪断 -

例如,使用mu = 0sigma = 1从对数正态分布生成N-by-N随机值矩阵,如下所示:

N = 5;
A(triu(true(N))) = random('logn', 0,1, N*(N+1)/2, 1);
A(tril(true(N))) = A(triu(true(N)));