加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

MATLAB 函数random()

(2011-04-10 10:05:29)
标签:

杂谈

分类: 学习
random

Random numbers
Syntax

Y = random(name,A)
Y = random(name,A,B)
Y = random(name,A,B,C)
Y = random(...,m,n,...)
Y = random(...,[m,n,...])
Description

Y = random(name,A) returns random numbers Y from the one-parameter family of distributions specified by name. Parameter values for the distribution are given in A.

Y is the same size as A.

Y = random(name,A,B) returns random numbers Y from a two-parameter family of distributions. Parameter values for the distribution are given in A and B.

If A and B are arrays, they must be the same size. If either A or B are scalars, they are expanded to constant matrices of the same size.

Y = random(name,A,B,C) returns random numbers Y from a three-parameter family of distributions. Parameter values for the distribution are given in A, B, and C.

If A, B, and C are arrays, they must be the same size. If any of A, B, or C are scalars, they are expanded to constant matrices of the same size.

Y = random(...,m,n,...) or Y = random(...,[m,n,...]) returns an m-by-n-by... matrix of random numbers.

If any of A, B, or C are arrays, then the specified dimensions must match the common dimensions of A, B, and C after any necessary scalar expansion.

Acceptable strings for name are:

    *

      'beta' (Beta distribution)
    *

      'bino' (Binomial distribution)
    *

      'chi2' (Chi-square distribution)
    *

      'exp' (Exponential distribution)
    *

      'ev' (Extreme value distribution)
    *

      'f' (F distribution)
    *

      'gam' (Gamma distribution)
    *

      'gev' (Generalized extreme value distribution)
    *

      'gp' (Generalized Pareto distribution)
    *

      'geo' (Geometric distribution)
    *

      'hyge' (Hypergeometric distribution)
    *

      'logn' (Lognormal distribution)
    *

      'nbin' (Negative binomial distribution)
    *

      'ncf' (Noncentral F distribution)
    *

      'nct' (Noncentral tdistribution)
    *

      'ncx2' (Noncentral chi-square distribution)
    *

      'norm' (Normal distribution)
    *

      'poiss' (Poisson distribution)
    *

      'rayl' (Rayleigh distribution)
    *

      't' (t distribution)
    *

      'unif' (Uniform distribution)
    *

      'unid' (Discrete uniform distribution)
    *

      'wbl' (Weibull distribution)

Examples

Generate a 2-by-4 array of random values from the normal distribution with mean 0 and standard deviation 1:

x1 = random('Normal',0,1,2,4)
x1 =
  1.1650  0.0751  -0.6965  0.0591
  0.6268  0.3516  1.6961  1.7971

The order of the parameters is the same as for normrnd.

Generate a single random value from Poisson distributions with rate parameters 1, 2, ..., 6, respectively:

x2 = random('Poisson',1:6,1,6)
x2 =
        7

See Also

cdf, pdf, icdf, mle

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有