# Real-Imag to Complex

Convert real and/or imaginary inputs to complex signal

• Library:
• Simulink / Math Operations

HDL Coder / Math Operations

## Description

The Real-Imag to Complex block converts real and/or imaginary inputs to a complex-valued output signal.

The inputs can both be arrays (vectors or matrices) of equal dimensions, or one input can be an array and the other a scalar. If the block has an array input, the output is a complex array of the same dimensions. The elements of the real input map to the real parts of the corresponding complex output elements. The imaginary input similarly maps to the imaginary parts of the complex output signals. If one input is a scalar, it maps to the corresponding component (real or imaginary) of all the complex output signals.

## Ports

### Input

expand all

Real value to be converted to complex-valued output signal, specified as a scalar, vector, or matrix.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `fixed point` | `bus`

Imaginary value to be converted to complex-valued output signal, specified as a scalar, vector, or matrix.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `fixed point` | `bus`

Real or imaginary value to convert to complex output signal, specified as a finite scalar, vector, or matrix.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `fixed point` | `bus`

### Output

expand all

Complex signal, formed from real and imaginary values.

Data Types: `single` | `double` | `int8` | `int16` | `int32` | `int64` | `uint8` | `uint16` | `uint32` | `uint64` | `fixed point`

## Parameters

expand all

Specify the type of input: a real input, an imaginary input, or both.

#### Programmatic Use

 Block Parameter: `Input` Type: character vector Values: `'Real and imag' | 'Real' | 'Imag'` Default: `'Real and imag'`

Specify the imaginary value to use when converting the input to a complex-valued output signal.

#### Dependencies

To enable this parameter, set Input to `Real`.

#### Programmatic Use

 Block Parameter: `ConstantPart` Type: character vector Values: imaginary value Default: `'0'`

Specify the constant real value to use when converting the input to a complex-valued output signal.

#### Dependencies

To enable this parameter, set Input to `Imag`.

#### Programmatic Use

 Block Parameter: `ConstantPart` Type: character vector Values: finite, real-valued scalar, vector, or matrix Default: `'0'`

Specify the sample time as a value other than `-1`. For more information, see Specify Sample Time.

#### Dependencies

This parameter is not visible unless it is explicitly set to a value other than `-1`. To learn more, see Blocks for Which Sample Time Is Not Recommended.

#### Programmatic Use

 Block Parameter: `SampleTime` Type: string scalar or character vector Default: `"-1"`

## Block Characteristics

 Data Types `double` | `fixed point` | `integer` | `single` Direct Feedthrough `yes` Multidimensional Signals `yes` Variable-Size Signals `yes` Zero-Crossing Detection `no`

## Version History

Introduced before R2006a