Main Content

Unipolar to Bipolar Converter

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

Library

Utility Blocks

  • Unipolar to Bipolar Converter block

Description

The Unipolar to Bipolar Converter block maps the unipolar input signal to a bipolar output signal. If the input consists of integers between 0 and M-1, where M is the M-ary number parameter, then the output consists of integers between -(M-1) and M-1. If M is even, then the output is odd. If M is odd, then the output is even. This block is only designed to work when the input value is within the set {0,1,2...(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 2k-(M-1)
Negative -2k+(M-1)

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

  • int16

  • int32

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, an ideal signed integer output word length required to contain the range [-(M-1)M-1] is computed as follows:

      ideal word length = ceil(log2(M))+1

      Note

      The +1 is associated with the need for the sign bit.

    • The block sets the output data type to be a signed 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) pertaining to word length constraints do not affect how this block determines output data types.

Examples

If the input is [0; 1; 2; 3], the M-ary number parameter is 4, and the Polarity parameter is Positive, then the output is [-3; -1; 1; 3]. Changing the Polarity parameter to Negative changes the output to [3; 1; -1; -3].

If the value for the M-ary number is 27 the block gives an output of int8.

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

Extended Capabilities

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

Version History

Introduced before R2006a