randint
功能:返回0,1值,这在编程中会用到。
语法:out = randint ,out = randint(m),out = randint(m,n)out = randint返回0或者1,等概率;out = randint(m),返回m*m的0,1矩阵,矩阵中每个位置取0的概率都是0.5。out =randint(m,n)道理类似。
ones
功能:返回全是1 的数组
语法:Y = ones(n),Y = ones(m,n)
>> ones(3)
ans =
1 1 1
1 1 1
1 1 1
zeros
功能:返回全是0的数组
语法:B = zeros(n),B = zeros(m,n)
>> zeros(3)
ans =
0 0 0
0 0 0
0 0 0