主要内容

Bernoulli二进制发电机

Generate Bernoulli-distributed random binary numbers

  • 库:
  • 通信工具箱 /通讯来源 /随机数据源

  • Bernoulli二进制发电机block

Description

Bernoulli二进制发电机块使用Bernoulli分布生成随机二进制数字。使用此块生成随机数据位来模拟数字通信系统并获得性能指标,例如位错误率。带有参数的Bernoulli分布p产生零的概率p还有一个概率1-p。The Bernoulli distribution has mean value1-p和差异p(1-p). TheProbability of zeroparameter specifiesp和can be any real number in range [0, 1].

The output signal can be a column or row vector, two-dimensional matrix, or scalar. The number of rows in the output signal corresponds to the number of samples in one frame and is set by theSamples 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 theProbability of zero范围。有关更多详细信息,请参阅Sources and SinksinCommunications Toolbox™ User's Guide

端口

Output

expand all

Output data signal, returned as a scalar, vector, or matrix.

Data Types:double

Parameters

expand all

Probability of zero must be in the range of [0, 1]. The number of elements in theProbability of zeroparameter corresponds to the number of independent channels output from the block. The Bernoulli distribution with parameterp产生零的概率p还有一个概率1-p

SelectParameter使用最初的种子参数以指定随机数生成器的初始种子。

Note

When theSource of initial seed参数设置为汽车和the模拟使用参数设置为代码生成,随机数生成器使用零的初始种子。在这种情况下,每次启动时,块会生成相同的随机数。为确保模型使用不同的初始种子,请设置模拟使用parameter to解释执行。如果您运行解释执行inRapid acceleratormode, then the model behaves the same as代码生成mode.

Dependencies

Select汽车for the block to use the global random number stream as the initial seed. For more information, seeManaging the Global Stream Using RandStream随机数生成器

If you set the最初的种子参数为恒定值,然后结果序列是可重复的。

Dependencies

要启用此参数,请设置Source of initial seedtoParameter

Positive scalars specify the time in seconds between each sample of the output signal. If you set theSample timeto-1, the output signal inherits the sample time from downstream. For information on the relationship between theSample timeSamples per frameparameters, seeSample Timing

输出信号的一个通道中的每帧样品,指定为正整数。有关关系的信息Sample timeSamples per frame, seeSample Timing

Select the data type for the output signal.

Type of simulation to run, specified as代码生成或者解释执行

  • 代码生成- 通过使用生成的C代码模拟模型。您第一次运行模拟,Simulink万博1manbetx®generates C code for the block. The C code is reused for subsequent simulations unless the model changes. This option requires additional startup time, but the speed of the subsequent simulations is faster than解释执行

  • 解释执行–– Simulate the model by using the MATLAB®口译员。此选项比启动时间少于代码生成method, but the speed of subsequent simulations is slower. In this mode, you can debug the source code of the block.

块特征

Data Types

Boolean|double|整数|single

Multidimensional Signals

Variable-Size Signals

More About

expand all

Extended Capabilities

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

版本历史

在R2006a之前引入

expand all

R2020a中的行为发生了变化