Main Content

Complex Phase Difference

Phase difference between two complex signals

  • Complex Phase Difference block

Libraries:
Communications Toolbox / Utility Blocks

Description

The Complex Phase Difference block computes the phase difference in radians between the second input signal and the first input signal. The elements of the output are between -π and π. This block independently processes each pair of corresponding elements.

Examples

expand all

The model generates random integers and applies QPSK modulation. The first QPSK modulator has a phase offset of 0, while the second has a pi/4 phase offset.

The Complex Phase Difference block determines the phase difference. The data is passed to the workspace by using the To Workspace (Simulink) block.

Run the model and display the calculated phase difference.

The calculated phase difference is: -0.7854

The phase difference from the second input to the first input is equal to -pi/4 as expected.

The model applies QPSK modulation, and then applies a phase shift to a signal. Calculate the phase difference and plot the constellation of the signal before and after the phase shift.

The Complex Phase Shift block applies a 30 degree phase shift to a QPSK modulated signal. The Complex Phase Difference block determines the phase difference. A To Workspace (Simulink) block passes the calculated phase difference to the workspace. A Constellation Diagram block plots the signal constellation before and after the phase shift.

The phase difference is calculated from the second input to the first input.

The calculated phase difference is: -30.0000

Ports

Input

expand all

First input signal, specified as a scalar, column vector, or matrix. If both input signals are nonscalar, they must be the same dimension.

Note

This block processes complex signals. Real values at the input ports are type cast to complex values with +j0 complex components.

Data Types: double | single
Complex Number Support: Yes

Second input signal, specified as a scalar, column vector, or matrix. If both input signals are nonscalar, they must be the same dimension. In2 must be the same data type as In1.

Note

This block processes complex signals. Real values at the input ports are type cast to complex values with +j0 complex components.

Data Types: double | single

Output

expand all

Phase shift difference in radians, returned as a scalar, column vector, or matrix. If either input signal is nonscalar, the output signal dimension matches the dimension of the nonscalar input signal. The output is the phase difference between the second input signal and the first input signal. The elements of the output signal are between -π and π and are the same data type as the input signals.

Block Characteristics

Data Types

double | single

Multidimensional Signals

no

Variable-Size Signals

no

Extended Capabilities

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

Version History

Introduced before R2006a

See Also

Blocks