Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Magnitude and phase angle of complex signal—optimized for HDL code generation

The `dsp.HDLComplexToMagnitudeAngle`

System
object™ computes the magnitude and phase angle of a complex signal. It provides
hardware-friendly control signals. The System
object uses a pipelined coordinate rotation digital computer (CORDIC) algorithm to
achieve an HDL-optimized implementation.

To compute the magnitude and phase angle of a complex signal:

Create the

`dsp.HDLComplexToMagnitudeAngle`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects? (MATLAB).

`HCMA = dsp.HDLComplexToMagnitudeAngle`

`HCMA = dsp.HDLComplexToMagnitudeAngle(Name,Value)`

returns a `HCMA`

= dsp.HDLComplexToMagnitudeAngle`dsp.HDLComplexToMagnitudeAngle`

System
object, `HCMA`

, that computes the magnitude and phase angle of a
complex input signal.

sets properties of `HCMA`

= dsp.HDLComplexToMagnitudeAngle(`Name,Value`

)`HCMA`

using one or more name-value pairs. Enclose
each property name in single quotes.

```
cma =
dsp.HDLComplexToMagnitudeAngle('AngleFormat','Radians')
```

**For versions earlier than R2016b, use the step
function to run the System object algorithm. The arguments to
step are the object you created, followed by
the arguments shown in this section.**

**For example, y = step(obj,x) and y = obj(x) perform equivalent operations.**

```
[mag,angle,validOut]
= HCMA(X,validIn)
```

```
[mag,validOut]
= HCMA(X,validIn)
```

```
[angle,validOut]
= HCMA(X,validIn)
```

`[`

returns only the component magnitude of `mag`

,`validOut`

]
= HCMA(`X`

,`validIn`

)`X`

.

To use this syntax, set OutputValue to
`'Magnitude'`

.

```
HCMA =
dsp.HDLComplextoMagnitudeAngle('OutputValue','Magnitude');
```

`[`

returns only the component phase angle of `angle`

,`validOut`

]
= HCMA(`X`

,`validIn`

)`X`

.

To use this syntax, set OutputValue to
`'Angle'`

.

```
HCMA =
dsp.HDLComplextoMagnitudeAngle('OutputValue','Angle');
```

To use an object function, specify the
System
object as the first input argument. For
example, to release system resources of a System
object named `obj`

, use
this syntax:

release(obj)