matlab randerr函式
randerr 產生比特誤差樣本下面是matlab幫助文檔的解釋:
RANDERR Generate bit error patterns.
OUT = RANDERR(M) generates an M-by-M binary matrix with exactly
one "1" randomly placed in each row.
OUT = RANDERR(M,N) generates an M-by-N binary matrix with exactly
one "1" randomly placed in each row.
OUT = RANDERR(M,N,ERRORS) generates an M-by-N binary matrix, with
the number of "1"s in any given row determined by ERRORS.
ERRORS can be either a scalar, row vector or two-row matrix:
Scalar: If ERRORS is a scalar the number of "1"s to place in each
row is defined by ERRORS.
Vector: If ERRORS is a row vector, then its elements specify how
many "1"s are possible.Every number of "1"s included in
this vector occur with equal probability.
Two-Row : If ERRORS is a two-row matrix, the first row specifies how
Matrix many "1"s are possible and the second row specifies the
probabilities of each corresponding number of "1"s.The
elements in the second row of ERRORS must sum to one.
OUT = RANDERR(M,N,ERRORS,STATE) resets the state of RAND to STATE.
This function can be useful for testing error-control coding.
Examples:
?out = randerr(2,5)?out = randerr(2,5,2)
out =out =
0 0 0 1 0 0 0 1 0 1
1 0 0 0 0 0 1 1 0 0
?out = randerr(2,5,[1 3]) ?out = randerr(2,5,[1 3;0.8 0.2])
out =out =
1 0 1 1 0 0 1 0 0 0
1 0 0 0 0 0 0 0 1 0
See also rand, randsrc, randint.
Reference page in Help browser
doc randerr