Bernoulli Binary Generator
Generates random binary numbers using the Bernoulli distribution.
Description
The Bernoulli Binary Generator block generates random binary numbers using the Bernoulli distribution. Use this block to generate random bits of data to simulate digital communication systems and obtain performance metrics such as bit error rates. The Bernoulli distribution with the parameter gives zero with probability and one with probability . The Bernoulli distribution has a mean of and a variance of . The parameter Probability of zero sets the value of the variable and can be any real number in the range [0, 1].
The output signal can be a column vector or row vector, a two-dimensional matrix or a scalar. The number of rows in the output signal corresponds to the number of samples in one frame and is specified by the Samples per frame parameter. The number of columns in the output signal corresponds to the number of channels and is specified by the number of elements in the Probability of zero parameter.
Parameters
Main
Probability of zero - probability of getting zero on the output
` 0.5 (by default)` | ` integer in the range [0, 1]` | ` vector of integers in the range [0, 1]`
The probability of getting zero on the output must be in the range [0, 1].
The number of elements in the Probability of zero parameter corresponds to the number of independent channels output from the block. Bernoulli distribution with the parameter gives zero with probability and one with probability .
Source of initial seed - source of initial value
Auto (By default)
| Parameter
Source of initial value for random number generator in the form:
-
Parameter
- the block sets the initial value of the random number generator in the Initial seed parameter.
Initial seed - initial value
0 (by default)
| non-negative scalar
.
Initial value for the random number generator as a non-negative integer. If the Initial seed parameter is a constant, the resulting sequence will be repeated.
Dependencies
To use this parameter, set the Source of initial seed parameter to Parameter
.
Sample time - sampling period
1 (by default)
| -1
| positive scalar
The sampling period specified as a positive number. To inherit the sampling period, set this parameter to -1
.
Samples per frame - samples per output frame
1 (By default)
| `positive scalar'.
Samples per frame as a positive integer indicating the number of samples per frame in one output data channel.
Output data type - output data type
double (by default)
| int
Select the data type for the output signal type.
Read more
Calculating the interval between samples
The interval between samples is equal to the product of Samples per frame and Sample time.
For example, if Sample time and Samples per frame are equal to 1
, the unit outputs one sample every second. If you increase the value of Samples per frame to 10
, the block will output a 10 by 1 vector every 10 seconds.
This synchronisation ensures that the equivalent output rate is independent of the Samples per frame parameter.