所有栏目

matlab怎么生成随机的高斯分布点

已输入 0 字
优质回答
  • MATLAB命令是normrnd

    功能:生成服从正态分布的随机数列,也就是你需要的高斯随机序列

    >> help normrnd

    NORMRND Random arrays from the normal distribution.

    R = NORMRND(MU,SIGMA) returns an array of random numbers chosen from a

    normal distribution with mean MU and standard deviation SIGMA.The size

    of R is the common size of MU and SIGMA if both are arrays.If either

    parameter is a scalar, the size of R is the size of the other

    parameter.

    R = NORMRND(MU,SIGMA,M,N,...) or R = NORMRND(MU,SIGMA,[M,N,...])

    returns an M-by-N-by-... array.

    语法:

    R=normrnd(MU,SIGMA)

    R=normrnd(MU,SIGMA,m)

    R=normrnd(MU,SIGMA,m,n)

    说 明:

    R=normrnd(MU,SIGMA):生成服从正态分布(MU参数代表均值,DELTA参数代表标准差)的随机数。输入的向量或矩阵MU和SIGMA必须形式相同,输出R也和它们形式相同。标量输入将被扩展成和其它输入具有 相同维数的矩阵。

    R=norrmrnd(MU,SIGMA,m):生成服从正态分布(MU参数代表均值,DELTA参数代表标准差)的 随机数矩阵,矩阵的形式由m定义。m是一个1×2向量,其中的两个元素分别代表返回值R中行与列的维数。

    R=normrnd(MU,SIGMA,m,n): 生成m×n形式的正态分布的随机数矩阵。

    例:

    >> A = normrnd(0,1,1,100);

    >> plot(A)

    注:正态分布只需要2个参数。

    randn() 是标准正态分布;

    normrnd()是自己可以指定均数和标准差的正太分布。

    2023-10-23 20:21:17
  • 如图所示,蓝色点100个服从N(3.5, 1), 红色点服从N(1, 1). 2023-10-23 20:21:17
最新问题 全部问题