Convert magnitude and/or a phase angle signal to complex signal
Simulink / Math Operations
HDL Coder / HDL Floating Point Operations
The Magnitude-Angle to Complex block converts magnitude and phase angle inputs to a complex output. The angle input must be in rad.
The block supports the following combinations of input dimensions when there are two block inputs:
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.
If you use the CORDIC approximation method [1], the block input for phase angle has the following 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.
The following table summarizes what happens for an out-of-range input:
Block Usage | Effect of Out-of-Range Input |
---|---|
Simulation modes | An error appears. |
Generated code | Undefined behavior occurs. |
Ensure that you use an in-range input for the Magnitude-Angle to Complex block when you use the CORDIC approximation. Avoid relying on undefined behavior for generated code or accelerator modes.
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
[1] Volder, JE. “The CORDIC Trigonometric Computing Technique.” IRE Transactions on Electronic Computers EC-8 (1959); 330–334.
[2] Andraka, R. “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.” Hewlett-Packard Company, Palo Alto. Spring Joint Computer Conference (1971): 379–386. (from the collection of the Computer History Museum). www.computer.org/csdl/proceedings/afips/1971/5077/00/50770379.pdf
[4] Schelin, Charles W. “Calculator Function Approximation.” The American Mathematical Monthly 90, no. 5 (1983): 317–325.