Engee documentation

Bernoulli Binary Generator

Generates random binary numbers using the Bernoulli distribution.

blockType: BernoulliBinaryGenerator

Path in the library:

/Communication Systems/Sources/Random Data Sources/Bernoulli Binary Generator

Description

Block Bernoulli Binary Generator generates random binary numbers using the Bernoulli distribution. Use this block to generate random data bits to simulate digital communication systems and obtain performance metrics such as the bit error rate. Bernoulli distribution with parameter gives zero with probability and one with probability . The Bernoulli distribution has an average value and the variance . Parameter Probability of zero sets the value of a variable and it can be any real number in the range [0, 1].

The output signal can be a column vector or a row vector, a two-dimensional matrix, or a scalar. The number of lines in the output signal corresponds to the number of samples in one frame and is set by the parameter Samples per frame. The number of columns in the output signal corresponds to the number of channels and is set by the number of elements in the parameter Probability of zero.

Ports

Output

# OUT_1 — The output signal
scalar | vector | the matrix

Details

The output signal returned as a scalar, vector, or matrix.

Data types

Float64, Int64

Complex numbers support

No

Parameters

Main

# Probability of zero — the probability of getting zero at the exit
Scalar / vector of real numbers

Details

The probability of getting zero at the output should be in the range [0, 1].

The number of elements in the parameter Probability of zero corresponds to the number of independent channels output from the block. Bernoulli distribution with parameter gives zero with probability and one with probability .

Default value

0.5

Program usage name

ProbabilityOfZero

Tunable

No

Evaluatable

Yes

# Source of initial seed — source of the initial value
Parameter

Details

The source of the initial value for the random number generator in the form:

  • Parameter — the block sets the initial value of the random number generator in the parameter Initial Seed.

Values

Parameter

Default value

Parameter

Program usage name

SourceOfInitialSeed

Tunable

No

Evaluatable

No

# Initial Seed — initial value
Real number

Details

The initial value for the random number generator in the form of a non-negative integer. If the parameter Initial Seed is a constant, the resulting sequence will be repeated.

Dependencies

To use this parameter, set for the parameter Source of initial seed meaning Parameter.

Default value

0

Program usage name

InitialSeed

Tunable

No

Evaluatable

Yes

# Sample time — sampling period
SampleTime (real number / vector of two real numbers)

Details

The sampling period, set as a positive number. To inherit the sampling period, set this parameter to −1.

Default value

1

Program usage name

SampleTime

Tunable

No

Evaluatable

Yes

# Samples per frame — counts per output frame
Int64 integer

Details

Samples per frame as a positive integer indicating the number of samples per frame in one output channel.

Default value

1

Program usage name

SamplesPerFrame

Tunable

No

Evaluatable

Yes

# Output data type — type of output data
double | int

Details

Select the data type for the output signal.

Values

double | int

Default value

double

Program usage name

OutputDataType

Tunable

No

Evaluatable

No

Additional Info

Calculation of the interval between counts

The interval between samples is equal to the product of the parameter values Samples per frame and Sample time.

For example, if Sample time and Samples per frame equal 1, the block outputs one count every second. If you increase the parameter value Samples per frame before 10, then the block will output a vector 10×1 each 10 seconds.

This synchronization ensures that the equivalent output speed is independent of the parameter. Samples per frame.