Engee documentation

Random Source

Generates randomly distributed values.

random source

Description

The Random Source block outputs a random signal with a uniform or Gaussian (normal) pseudo-random distribution. The block uses the Mersenne vortex random number generator to generate the sequence. The settings in the block dialogue box determine the signal size, data type and whether the signal is complex.

The block can generate a single-channel or multi-channel signal.

Ports

Output

# Port_1 signal with randomly distributed values
scalar | vector | matrix

Details

A signal of random variables with uniform or Gaussian (normal) distribution. The settings in the block dialogue box determine the size of the signal, the data type and whether the signal is complex.

The block can generate a single-channel or multi-channel signal. The Samples per frame parameter defines the number of samples in each channel (column) of the signal. The Output data type and Signal complexity parameters determine the data type and whether the signal is complex.

Data types

Float64.

Support for complex numbers: Yes

Parameters

Main

# Source type — distribution type
Uniform | Gaussian

Details

Specify the type of distribution of random variables, options to choose from:

  • Uniform - the block takes output samples from uniform distribution. You can specify the minimum and maximum values of the distribution using the Minimum and Maximum parameters, respectively. All values in the range [Minimum Maximum] have equal probability to be selected. You can generate a complex number from a uniform distribution by setting the Signal complexity parameter to Complex.

  • Gaussian - the block generates Gaussian random variables using the Ziggurat method. You can specify the mean and variance of the distribution using the Mean and Variance parameters. You can generate a complex Gaussian signal by setting the Signal complexity parameter to Complex.

Values

Uniform | Gaussian

Default value

Uniform

Program usage name

SourceType

Tunable

No

Evaluatable

No

# Method — random number generation method
Ziggurat | Sum of uniform values

Details

Random number generation method.

Dependencies

To use this parameter, set the Source type parameter to Gaussian.

Values

Ziggurat | Sum of uniform values

Default value

Ziggurat

Program usage name

Method

Tunable

No

Evaluatable

No

# Number of uniform values to sum — number of constant values to summarise
Int64 integer

Details

Number of constant values for summing.

Dependencies

To use this parameter, set the Source type parameter to Gaussian and the Method parameter to Sum of uniform values.

Default value

12

Program usage name

NumberOfUniformValuesToSum

Tunable

No

Evaluatable

Yes

# Mean — mean value of the Gaussian distribution

Details

Specify the mean value of a Gaussian (normal) distribution as a scalar or a string vector of length . If a string vector is specified, the block generates a matrix by , containing a separate random distribution in each channel, where is the value specified in the Samples per frame parameter.

The values of the Mean and Variance parameters must be scalars or have the same number of columns.

To generate a complex output signal with a Gaussian distribution, set the Signal complexity parameter to Complex and specify the complex value in the Mean parameter. For more information, refer to the description of the Signal complexity parameter.

Dependencies

To use this parameter, set the Source type to Gaussian.

Support for complex numbers

Yes

Default value

0

Program usage name

Mean

Tunable

Yes

Evaluatable

Yes

# Variance — variance of the Gaussian distribution

Details

Specify the variance of a Gaussian (normal) distribution as a scalar or string vector of length . If a string vector is specified, the block generates a matrix by , containing a separate random distribution in each channel, where is the value specified in the Samples per frame parameter.

The values of the Mean and Variance parameters must be scalars or have the same number of columns.

To generate a complex output signal with a Gaussian distribution, set the Variance parameter to total variance for each output channel. This value is the sum of the variance of the real and imaginary components in that channel. For more information, see the description of the Signal complexity parameter.

Dependencies

To use this parameter, set the Source type parameter to Gaussian.

Default value

1

Program usage name

Variance

Tunable

Yes

Evaluatable

Yes

# Minimum — minimum value of uniform distribution

Details

Specify the minimum value in the uniform distribution as a scalar or string vector of length . If a string vector is specified, the block generates a matrix by , containing a separate random distribution in each channel, where is the value specified in the Samples per frame parameter.

For example, if the value of Minimum is [0, 0, -3, -3] and Maximum is [10, 10, 20, 20], then the block generates a four-channel output whose first and second columns contain random values in the range [0, 10] and whose third and fourth columns contain random values in the range [-3, 20].

The Minimum and Maximum values must be scalars or have the same number of columns.

Dependencies

To use this parameter, set the Source type parameter to Uniform.

Default value

0

Program usage name

Minimum

Tunable

Yes

Evaluatable

Yes

# Maximum — maximum value of uniform distribution

Details

Specify the maximum value in the uniform distribution as a scalar or string vector of length . If a string vector is specified, the block generates a matrix by , containing a separate random distribution in each channel, where is the value specified in the Samples per frame parameter.

For example, if the value of Minimum is [0, 0, -3, -3] and Maximum is [10, 10, 20, 20], then the block generates a four-channel output whose first and second columns contain random values in the range [0, 10] and whose third and fourth columns contain random values in the range [-3, 20].

The Minimum and Maximum values must be scalars or have the same number of columns.

Dependencies

To use this parameter, set the Source type parameter to Uniform.

Default value

1

Program usage name

Maximum

Tunable

Yes

Evaluatable

Yes

# Repeatability — block output repetition
Specify seed | Repeatable | Not repeatable

Details

Option to repeat the block output. Options to select:

  • Specify seed - the block uses the initial number that is specified in the Initial seed parameter to produce repeatable output for each simulation.

  • Not repeatable - the block randomly selects an initial number and produces a different pseudorandom sequence for each simulation.

  • Repeatable.

Values

Specify seed | Repeatable | Not repeatable

Default value

Not repeatable

Program usage name

Repeatability

Tunable

No

Evaluatable

No

# Initial seed — initial number for the random number generator

Details

Specify an initial number for a random number generator in the form of a scalar. The generator produces an identical sequence of pseudo-random numbers each time a block with a certain initial number is simulated.

Dependencies

To use this parameter, set the Repeatability parameter to Specify seed.

Default value

1

Program usage name

InitialSeed

Tunable

Yes

Evaluatable

Yes

# Sample mode — signal type
Discrete | Continuous

Details

Signal Type. Options for selection:

  • Discrete - discrete signal.

  • Continuous - continuous signal.

Values

Discrete | Continuous

Default value

Discrete

Program usage name

SampleMode

Tunable

No

Evaluatable

No

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

Details

The output sampling period, of a random output sequence, is specified as a positive scalar. The period of the output frame is equal to .

Dependencies

To use this parameter, set the Sample mode parameter to Discrete.

Default value

1

Program usage name

SampleTime

Tunable

No

Evaluatable

Yes

# Samples per frame — counts per frame
Int64 integer

Details

Number of samples in each output frame, specified as a positive integer scalar. Output frame period is equal to , where is the value of Sample time parameter.

Dependencies

To use this parameter, set the Sample mode parameter to Discrete.

Default value

1

Program usage name

SamplesPerFrame

Tunable

No

Evaluatable

Yes

# Output data type — output data type
Double

Details

Output data type.

Values

Double

Default value

Double

Program usage name

OutputDataType

Tunable

No

Evaluatable

No

# Complexity — real or complex signal
Real | Complex

Details

Specify whether the output signal is real Real or complex Complex. These parameters control all output channels. The real and complex components of the output are statistically independent.

For complex output with a `Uniform' distribution, the block takes the real and imaginary components in each channel from the same uniform random distribution defined by the Minimum and Maximum parameters for that channel.

For complex output with a Gaussian' distribution, the block takes the real and imaginary components in each channel from normal distributions with different averages. In this case, the Mean parameter for each channel must have a complex value. The real component of the Mean parameter determines the mean of the real components in the channel, and the imaginary component determines the mean of the imaginary components in the channel. If the real or imaginary component in the Mean parameter is omitted, the block uses the default value `0 for the average value of this component.

For example, if the Mean parameter has [5+2i 0.5 3i] in it, a three-channel output with these average values is generated.

Channel number Real component Minimised component

1

5

2

2

0.5

0

3

0

3

For a complex output signal, the Variance parameter defines the total variance for each output channel. This value is the sum of the variance of the real and imaginary components in that channel:

.

The block divides the specified variance value equally between the real and imaginary components.

,

.

Values

Real | Complex

Default value

Real

Program usage name

Complexity

Tunable

No

Evaluatable

No

Read More

Uniform distribution

A uniform distribution is a type of probability distribution in which all outcomes are equally likely.

*A scalar random variable.

Consider a scalar random variable , which the block takes from the uniform distribution U:

,

where and are the minimum and maximum values of the distribution, respectively.

Alternatively, we can write in terms of a scaled normalised uniform variable:

,

.

*A uniform random vector.

If the block is configured to have channels, then each output sample is a random vector of independent data. We can write as , where , with и - are the minimum and maximum values of the vector parameters, respectively. If the Samples per frame parameter is set to , then each output frame is a by matrix of independent homogeneous random vector rows.

Complex uniform random variable

If the block is configured to generate a complex scalar random variable , where .

Alternatively, you can write as

,

.

Complex uniform random vector

Where is a vector of complex random variables , where are independent.

Gaussian distribution

Scalar random variable

If the block is configured to generate a random variable from a Gaussian (or normal) distribution, the variable , where and are the mean and variance, respectively.

Alternatively, you can write as , where is the standard normal variable.

*Gaussian random vector.

If there are channels in the block, then each output sample is a random vector of independent data. We can write the Gaussian random vector as , where , where и - are the mean and variance of channels, respectively. The covariance matrix of the vector is a diagonal matrix represented as

.

*Complex Gaussian random variable.

If the block is configured to generate a complex scalar random variable , where and are independent. The mean value must be complex.

Alternatively, you can write as

.

*Complex Gaussian random vector.

Where is a vector of complex random variables , where and , и - are the mean and variance of channels, respectively.