Main Content

Bipolar to Unipolar Converter

Map bipolar signal into unipolar signal in range [0, M-1]

Library

Utility Blocks

  • Bipolar to Unipolar Converter block

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}, where M is the M-ary number parameter, 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 the M-ary number parameter. 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 the Polarity parameter.

Polarity Parameter ValueOutput 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 of Negative causes the block to reverse the relative ordering 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 or double), the output data type is the same as the input data type.

  • If the input data type is not floating-point:

    • Based on the M-ary number parameter, 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

The selections in the 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], the M-ary number parameter is 4, and the Polarity parameter is Positive, then the output is [0; 1; 2; 3]. Changing the Polarity parameter to Negative changes the output to [3; 2; 1; 0].

If the value for the M-ary number is 28 the block gives an output of uint8.

If the value for the M-ary number is 28+1 the block gives an output of uint16.

Extended Capabilities

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

Version History

Introduced before R2006a