Main Content

Poisson Integer Generator

Generate Poisson-distributed random integers

  • Poisson Integer Generator block

Libraries:
Communications Toolbox / Comm Sources / Random Data Sources

Description

The Poisson Integer Generator block generates random integers using a Poisson distribution. The probability of generating a nonnegative integer k is λkexp(λ)/(k!), where λ is a positive number known as the Poisson parameter.

When you use this block to generate noise in a binary transmission channel, typical values for the Poisson parameter(Lambda) parameter are much less than 1.

Examples

expand all

Generate Poisson integers (k) and plot the distribution for various $\lambda$ values.

The doc_poisson_gen_src model generates integers with Poisson distributions for $\lambda$ values indicated on the histogram plot. The model configures the Poisson Integer Generator blocks to different $\lambda$ values and common values for the sample time and samples per frame. To configure the blocks, the model assigns workspace variables spf and Ts, initializing them by using the InitFcn callback. For more information, see Model Callbacks (Simulink).

Run the model and plot the Poisson distribution output for each $\lambda$ value.

Limitations

  • To use this block in a For Each Subsystem (Simulink) you must set Source of initial seed to Auto and the model to Normal or Accelerator simulation mode. This ensures that each run will generate independent noise samples.

Ports

Output

expand all

Random integer output, returned as a scalar, vector, or matrix. This port is unnamed on the block. Set the data type by using the Output data type parameter.

  • The number of rows in the output data corresponds to the number of samples in one frame and equals the value of the Samples per frame parameter.

  • The number of columns in the output signal corresponds to the number of channels and equals the number of elements in the Poisson parameter(Lambda) parameter.

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

The Poisson parameter λ, specified as a positive scalar or row vector of positive scalar values.

  • If you set this parameter to a scalar value, then every element in the output vector shares the same Poisson parameter.

  • If you set this parameter to a row vector, then the number of elements correspond to the number of independent channels output from the block.

Source of the initial seed for the random number generator, specified as either:

  • Auto –– The block uses the global random number stream. If you use the parsim (Simulink) function, see Tips.

  • Parameter –– The block sets the random number generator seed to Initial seed.

For more information, see Managing the Global Stream Using RandStream and Random Number Generators.

Initial seed value for the random number generator, specified as a nonnegative integer. If this parameter is a constant, then the resulting sequence is repeatable.

Tunable: Yes

Dependencies

To enable this parameter, set the Source of initial seed to Parameter.

Positive scalars specify the time in seconds between each sample of the output signal. If you set the sample time to -1, the output signal inherits the sample time from downstream. For information on the relationship between the Sample time and Samples per frame parameters, see Sample Timing.

Samples per frame in one channel of the output signal, specified as a positive integer. For information on the relationship between Sample time and Samples per frame, see Sample Timing.

Output data type, specified as double, uint8, uint16, uint32, or boolean.

Type of simulation to run, specified as Code generation or Interpreted execution.

  • Code generation — Simulate the model by using generated C code. The first time you run a simulation, Simulink generates C code for the block. The model reuses the C code for subsequent simulations unless the model changes. This option requires additional startup time, but the speed of the subsequent simulations is faster than with the Interpreted execution option.

  • Interpreted execution — Simulate the model by using the MATLAB® interpreter. This option shortens startup time, but the speed of subsequent simulations is slower than with the Code generation option. In this mode, you can debug the source code of the block.

For more information, see Simulation Modes (Simulink).

Block Characteristics

Data Types

double | integer

Multidimensional Signals

no

Variable-Size Signals

no

More About

expand all

Tips

Set Source of initial seed to Parameter and make sure that all blocks have different Initial seed values when running simulations in parallel using the parsim (Simulink) function, such as for Monte Carlo simulation runs.

Otherwise, the different workers may generate the same random numbers (leading to misleading results) for these model configurations:

  • If the model is in rapid accelerator mode.

  • If this block has Simulate using set to Code generation and Source of initial seed set to Auto.

For more information, see Choosing a Simulation Mode (Simulink).

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced before R2006a

expand all

See Also

Blocks

Functions

  • (Statistics and Machine Learning Toolbox)