Bipolar to Unipolar Converter
Map bipolar signal into unipolar signal in range [0, M-1]
Library
Utility Blocks
Description
The Bipolar to Unipolar Converter block maps the bipolar input signal to a unipolar output signal. If the input consists of integers in the set {-M+1, -M+3, -M+5,...,M-1}, whereMis theM-ary numberparameter, then the output consists of integers between 0 and M-1. This block is only designed to work when the input value is within the set {-M+1, -M+3, -M+5,...,M-1}, where M is theM-ary numberparameter. If the input value is outside of this set of integers the output may not be valid.
The table below shows how the block's mapping depends on thePolarityparameter.
Polarity Parameter Value | Output Corresponding to Input Value of k |
---|---|
Positive |
(M-1+k)/2 |
Negative |
(M-1-k)/2 |
Parameters
- M-ary number
-
The number of symbols in the bipolar or unipolar alphabet.
- Polarity
-
A value of
Positive
causes the block to maintain the relative ordering of symbols in the alphabets. A value ofNegative
导致块反向的相对排序of symbols in the alphabets. - Output Data Type
-
The type of bipolar signal produced at the block's output.
The block supports the following output data types:
Inherit via internal rule
Same as input
double
int8
uint8
int16
uint16
int32
uint32
boolean
When the parameter is set to its default setting,
Inherit via internal rule
, the block determines the output data type based on the input data type.If the input signal is floating-point (either
single
ordouble
), the output data type is the same as the input data type.If the input data type is not floating-point:
Based on theM-ary numberparameter, the output data type is the ideal unsigned integer output word length required to contain the range [0 M-1] and is computed as follows:
ideal word length = ceil(log2(M))
The block sets the output data type to be an unsigned integer, based on the smallest word length (in bits) that can fit best the computed ideal word length.
Note
的选择Hardware Implementation Pane(Simulink)pane pertaining to word length constraints do not affect how this block determines output data types.
Examples
If the input is [-3; -1; 1; 3], theM-ary numberparameter is4
, and thePolarityparameter isPositive
, then the output is [0; 1; 2; 3]. Changing thePolarityparameter toNegative
changes the output to [3; 2; 1; 0].
If the value for theM-ary numberis 28the block gives an output of uint8.
If the value for theM-ary numberis 28+1 the block gives an output of uint16.