# Unwrap Phase (G Dataflow)

Unwraps an array of phases by eliminating discontinuities whose absolute values exceed either pi or 180.

## reset

A Boolean that specifies whether to reset the internal state of the node.

 True Resets the internal state of the node. False Does not reset the internal state of the node.

This input is available only if you wire a double-precision, floating-point number to input phase.

Default: False

## input phase

Input array of phases to unwrap.

This input accepts a double-precision, floating-point number or a 1D array of double-precision, floating-point numbers.

## phase unit

Units for the input phases and unwrapped phases.

Name Value Description
radian in, degree out 1 Radian in, degree out
degree in, degree out 2 Degree in, degree out
degree in, radian out 3 Degree in, radian out

## error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error

## unwrapped phase

Unwrapped phases.

This output can return a double-precision, floating-point number or a 1D array of double-precision, floating-point numbers.

## error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

## Algorithm for Unwrapping Phases

When the difference between two adjacent values in input phase exceeds $\pi$, and phase unit is radian in, radian out, this node uses the following equation to calculate unwrapped phase:

$P_Out\left[i\right]=\left\{\begin{array}{cc}P\left[i\right]-⌊\frac{P\left[i\right]-P\left[i-1\right]}{2\pi }+0.5⌋*2\pi & i=1,\dots ,\text{}N-1\\ P\left[i\right]& i=0\end{array}$

where

• P_out is unwrapped phase
• P is input phase
• N is the length of input phase
• $⌊⌋$ is the floor operation

This node uses similar equations to calculate unwrapped phase for the other units you specify in phase unit.

## Effects of Unwrapping Phases

The following two graphs show the effects of unwrapping the phase. The first graph shows the original phase before unwrapping, and the second graph shows the phase after unwrapping.

## Unwrapping Phase Response of a Linear Time-Invariant System

You can apply this node to the computed phase response of a linear time-invariant system. The phase response is defined as the complex angle of the frequency response of a system. You compute the phase response as angles within [- $\pi$, $\pi$], or, in other words, as angles within one circle of 2* $\pi$ radians. Because multiples of 2* $\pi$ wrap when you compute the phase response, often there are discontinuities in the phase response from one frequency bin to the next.

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application