Magnitude-Angle to Complex
Convert magnitude and/or a phase angle signal to complex signal
Libraries:
Simulink /
Math Operations
HDL Coder /
HDL Floating Point Operations
Description
Supported Operations
The Magnitude-Angle to Complex block converts magnitude and phase angle inputs to a complex output. The angle input must be in rad.
When there are two block inputs, the block supports these combinations of input dimensions:
Two inputs of equal dimensions
One scalar input and the other an n-dimensional array
If the block input is an array, the output is an array of complex signals. The elements of a magnitude input vector map to the magnitudes of the corresponding complex output elements. Similarly, the elements of an angle input vector map to the angles of the corresponding complex output elements. If one input is a scalar, it maps to the corresponding component (magnitude or angle) of all the complex output signals.
Effect of Out-of-Range Input on CORDIC Approximations
If you use the CORDIC approximation method [1], the block input for phase angle has these restrictions:
For signed fixed-point types, the input angle must fall within the range [–2π, 2π) rad.
For unsigned fixed-point types, the input angle must fall within the range [0, 2π) rad.
This table summarizes the effects of an out-of-range input:
Block Usage | Effect of Out-of-Range Input |
---|---|
Simulation modes | An error appears. |
Generated code | Undefined behavior occurs. |
When you use the CORDIC approximation, ensure that you use an in-range input for the Magnitude-Angle to Complex block. Avoid relying on undefined behavior for generated code or accelerator modes.
Examples
Ports
Input
Output
Parameters
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
More About
References
[1] Volder, Jack E., “The CORDIC Trigonometric Computing Technique.” IRE Transactions on Electronic Computers EC-8 (1959); 330–334.
[2] Andraka, Ray “A Survey of CORDIC Algorithm for FPGA Based Computers.” Proceedings of the 1998 ACM/SIGDA Sixth International Symposium on Field Programmable Gate Arrays. Feb. 22–24 (1998): 191–200.
[3] Walther, J.S., “A Unified Algorithm for Elementary Functions,” Proceedings of the Spring Joint Computer Conference, May 18-20, 1971: 379–386.
[4] Schelin, Charles W., “Calculator Function Approximation,” The American Mathematical Monthly 90, no. 5 (1983): 317–325.