Contenuto principale

Bipolar to Unipolar Converter

Map bipolar signal to unipolar signal in range [0, M – 1]

  • Bipolar to Unipolar Converter block

Libraries:
Communications Toolbox / Utility Blocks

Description

The Bipolar to Unipolar Converter block maps the bipolar input signal to a unipolar output signal.

Examples

expand all

Use the Bipolar to Unipolar Converter to remap a signal from bipolar to unipolar.

The cm_convert_bipolar2unipolar model converts signals from bipolar to unipolar and displays the unipolar mapping.

With Output data type set to Inherit via internal rule, vary the M-ary number and Polarity settings, run the simulation, and then display the output of the Bipolar to Unipolar Converter block.

For the input signal int8([-3; -1; 1; 3]),
 With Polarity = Positive and M-ary number = 4:
  The output is 0  1  2  3, and type is uint8.
 With Polarity = Negative and M-ary number = 4:
  The output is 3  2  1  0, and type is uint8.
With Polarity = Positive and M-ary number = 2^8:
  The output is 126  127  128  129, and type is uint8.
 With Polarity = Positive and M-ary number = 2^8+1:
  The output is 126  127  128  129, and type is uint16.

Ports

Input

expand all

Input signal, specified as a scalar, vector, or matrix. The block expects a signal of integers in the set {–M+1, –M+3, –M+5,..., M – 1}, where M is the M-ary number parameter value.

The input signal is unnamed on the block mask.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32

Output

expand all

Output signal, returned as a signal of integers in the range [0, (M – 1)] with the same dimensions as the input signal, In. M is the M-ary number parameter value. The Output data type parameter specifies the desired data type.

The output signal is unnamed on the block mask.

Note

The output might not be valid for input signal values outside the set {–M+1, –M+3, –M+5,..., M – 1}.

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.

Number of symbols in the bipolar or unipolar alphabet, specified as a positive integer.

Relative ordering of symbols, specified as Positive or Negative.

  • Positive causes the block to maintain the relative ordering of symbols in the alphabets.

  • Negative causes the block to reverse the relative ordering of symbols in the alphabets.

The value of this parameter determines the output for input value k and M-ary number parameter value M.

 Output
Positive (M – 1 + k)/2
Negative (M – 1 – k)/2

Output data type of the unipolar signal, specified as Inherit via internal rule, Same as input, double, int8, int16, int32, uint8, uint16, uint32, or boolean.

When you set this parameter to Inherit via internal rule, the block determines the output data type based on the input data type as follows:

  • If the input data type is either single or double, the output data type is the same as the input data type.

  • If the input data type is not single or double:

    • For the M-ary number parameter value, M, the block computes the ideal signed integer output word length, ideal_word_length, required to contain the range [0, M – 1] as:

      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 best fit the computed ideal word length.

Note

Selections in the Hardware Implementation Pane (Simulink) that constrain word length do not affect how this block determines output data types.

Block Characteristics

Data Types

Boolean | double | fixed pointa | integer | single

Multidimensional Signals

no

Variable-Size Signals

no

a Signed only.

Extended Capabilities

expand all

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

Version History

Introduced before R2006a