在这里搜集我常用的Matlab functions. 大部分的说明在Matlab 官网都有。这里整理摘抄我最常用的一些function feature,以便之后调用:
A. generate uniform random variable:
如果有 Statistics and Machine Learning Toolbox, 可以用 unifrnd 来产生 continuous uniform random variable, 用 unidrnd 来产生 discrete uniform random variable. 以下是它们的常用用法:(因为看英文网站,节约翻译时间,就直接用英文了)
https://www.mathworks.com/help/stats/unifrnd.html
r=unifrnd(a,b)
It generates r as a uniform random variable in the range [
a
,
b
]
[a,b][a,b].
r=unifrnd(a,b,sz1,…,szN)
It generates a N-dimensional uniform random vector. Each dimension is a uniform random variable in the range of [
a
,
b
]
[a,b][a,b]. Theoretically, N
NN can be any finite positive integer.
https://www.mathworks.com/help/stats/unidrnd.html
r=unidrnd(n): n
nn specifies the largest possible value of r
rr. n
nn can be a scalar, vector or matrix. It then generate a scalar, vector or matrix correspondingly.
r=unidrnd(n,sz1,…,szN): the same as 2.