快捷搜索:  汽车  科技

matlab随机函数图像生成(Matlab内置的五种随机函数)

matlab随机函数图像生成(Matlab内置的五种随机函数)randperm(n) 产生一个1到n的随机顺序。randsrc(m n [alphabet; prob]) generates an m-by-n matrix with each entry independently chosen from the entries in the row vector alphabet. Duplicate values in alphabet are ignored. The row vector prob lists corresponding probabilities in prob.产生在[1 imax] 均匀分布的伪随机整数。randi(imax) returns a pseudorandom scalar integer between 1 and imax.randsrc(m n [alphabet; prob]) 产生一个

matlab随机函数图像生成(Matlab内置的五种随机函数)(1)

1、rand-均匀分布

rand 产生由在(0 1)之间均匀分布的随机数。

rand returns a single uniformly distributed random number in the interval (0 1).

matlab随机函数图像生成(Matlab内置的五种随机函数)(2)

2、randn-正态分布

randn 产生均值为0,方差为1的标准正态分布的随机数。

randn returns a random scalar drawn from the standard normal distribution.

matlab随机函数图像生成(Matlab内置的五种随机函数)(3)

3、randi-指定范围均匀分布

产生在[1 imax] 均匀分布的伪随机整数。

randi(imax) returns a pseudorandom scalar integer between 1 and imax.

matlab随机函数图像生成(Matlab内置的五种随机函数)(4)

4、randsrc-指定概率随机分布

randsrc(m n [alphabet; prob]) 产生一个m-by-n的矩阵,矩阵的元素从alphabet里抽取,alphabet每个元素被抽中的概率由prob指定。

randsrc(m n [alphabet; prob]) generates an m-by-n matrix with each entry independently chosen from the entries in the row vector alphabet. Duplicate values in alphabet are ignored. The row vector prob lists corresponding probabilities in prob.

matlab随机函数图像生成(Matlab内置的五种随机函数)(5)

5、randperm-随机排序

randperm(n) 产生一个1到n的随机顺序。

randperm(n) returns a row vector containing a random permutation of the integers from 1 to n inclusive.

matlab随机函数图像生成(Matlab内置的五种随机函数)(6)

matlab随机函数图像生成(Matlab内置的五种随机函数)(7)

猜您喜欢: