Complex to Magnitude-Angle
Compute magnitude and/or phase angle of complex signal
Libraries:
Simulink /
Math Operations
Description
The Complex to Magnitude-Angle block outputs the magnitude and/or phase angle of the input signal, depending on the setting of the Output parameter. The outputs are real values of the same data type as the block input. The input can be an array of complex signals, in which case the output signals are also arrays. The magnitude signal array contains the magnitudes of the corresponding complex input elements. The angle output similarly contains the angles of the input elements.
Ports
Input
Port_1 — Input signal
scalar | vector | matrix
Complex input signal that the block computes and outputs the magnitude and/or the phase angle.
Limitations
Fixed-point data types are supported only when you set the
Approximation method to
CORDIC
.
Data Types: single
| double
Output
Port_1 — Magnitude
scalar | vector | matrix
Output signal that is the magnitude and/or phase angle of the input signal. To choose the output, set the Output parameter.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| fixed point
Port_2 — Radian phase angle
scalar | vector | matrix
Radian phase angle, returned as a real-valued scalar, vector, or matrix.
Dependencies
To enable this port, set Output to
Magnitude and angle
orAngle
.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| fixed point
Parameters
Output — Magnitude and/or phase angle output specification
Magnitude and angle
(default) | Magnitude
|
Angle
Specify if the output is the magnitude and/or the phase angle in radians of the input signal.
Programmatic Use
Parameter:
Output
|
Type: character vector |
Values:
'Magnitude and angle' |
'Magnitude' |
'Angle' |
Default:
'Magnitude and angle'
|
Approximation method — Approximation method
None
(default) | CORDIC
Specify the type of approximation for computing output.
Approximation Method | Data Types Supported | When to Use This Method |
---|---|---|
None (default) | Floating-point | You want to use the default Taylor series algorithm. |
CORDIC
| Floating-point and fixed-point | You want a fast, approximate calculation. |
The block uses these data type propagation rules.
Data Type of Complex Input | Approximation Method | Data Type of Magnitude Output | Data Type of Angle Output |
---|---|---|---|
Floating point |
| Same as input | Same as input |
Signed, fixed point |
|
where:
|
where:
|
Unsigned, fixed point |
|
where:
|
where:
|
Programmatic Use
Block Parameter:
ApproximationMethod |
Type: character vector |
Values:
'None' | 'CORDIC' |
Default:
'None' |
Number of iterations — Number of iterations for CORDIC algorithm
11
(default) | positive integer, less than or equal to word length of fixed-point
input
Number of iterations the CORDIC algorithm performs, specified as a positive integer-valued scalar. Increasing the number of iterations can produce more accurate results but also increases the expense of the computation and adds latency.
Data Type of Block Inputs | Value You Can Specify |
---|---|
Floating-point | A positive integer. The maximum value is 52 for double or 23 for single. |
Fixed-point | A positive integer that does not exceed the word length of the magnitude input or the word length of the phase angle input, whichever value is smaller. |
Dependencies
To enable this parameter, set Approximation
method to CORDIC
.
Programmatic Use
Block Parameter:
NumberOfIterations |
Type: character vector |
Values: positive integer, less than or equal to word length of fixed-point input |
Default:
'11' |
Sample time (-1 for inherited) — Interval between samples
-1
(default) | scalar | vector
Specify the time interval between samples. To inherit the sample time, set this
parameter to -1
. For more information, see Specify Sample Time.
Dependencies
This parameter is visible only if you set it to a value other than
-1
. To learn more, see Blocks for Which Sample Time Is Not Recommended.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
Parameter: | SampleTime |
Values: | "-1" (default) | scalar or vector in quotes |
Block Characteristics
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
More About
CORDIC
CORDIC is an acronym for COordinate Rotation DIgital Computer. The Givens rotation-based CORDIC algorithm is one of the most hardware-efficient algorithms available because it requires only iterative shift-add operations (see References). The CORDIC algorithm eliminates the need for explicit multipliers. Using CORDIC, you can calculate various functions such as sine, cosine, arc sine, arc cosine, arc tangent, and vector magnitude. You can also use this algorithm for divide, square root, hyperbolic, and logarithmic functions.
Increasing the number of CORDIC iterations can produce more accurate results, but doing so increases the expense of the computation and adds latency.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Version History
Introduced before R2006aR2024b: Complex to Magnitude-Angle block supports fixed-point inputs
Complex to Magnitude-Angle block now
supports the CORDIC approximation method. This method allows fixed-point inputs at
input Port_1. To select the CORDIC method, set the new
Approximation method parameter to
CORDIC
.
When you select the CORDIC method, the block icon updates. The new parameter, Number of iterations, lets you define the number of iterations for the CORDIC algorithm.
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)