PhaseUnwrap (FPScript)
Unwraps phase angles for producing smoother phase responses.
Syntax
PhaseUnwrap(Phase, [ Jump ] [ , Tolerance ])
The syntax of the PhaseUnwrap function consists of the following parts:
Part |
Description |
---|---|
Phase |
The phase angle response to be corrected. Permitted data structures are data series, data matrix, signal, signal series und signal series with two-dimensional X-component. All real data types are permitted, except calendar time und time span. If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
Jump |
The step height of the phase angle response. The (discontinuous) phase angle response is thus corrected by adding or subtracting multiples of Jump. If the argument is not specified, it is set to the value 360 if Phase has the unit°, otherwise, it is set to TWO_PI. Permitted data structures are scalar value. All real data types are permitted, except calendar time und time span. The unit of the argument is ignored. The value must be greater than 0. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
Tolerance |
The minimum required tolerance value for unwrapping the phase angle response. The correction of the phase angle value now occurs if the absolute difference of two sequential phase angle values are greater than the Tolerance. If the argument is not specified, it is set to half of the value of the Jump argument. Permitted data structures are scalar value. All real data types are permitted, except calendar time und time span. The unit of the argument is ignored. The value must be greater than 0. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. |
Remarks
The data type of the result is always 64-bit floating point.
The structure of the result corresponds to that of the argument Phase.
For aggregate data structures, only the Y component is considered. If present, the X or Z components are copied to the result unchanged.
In the case of data matrices and signal series, the calculation is made on a per column basis. The values are converted to 64-bit floating point values before the calculation is made.
The PhaseUnwrap(Phase) command is used, for instance, to unwrap the phase response of a filter as follows:
The phase response shown in this diagram corresponds to the phase response of an IIR bandpass Butterworth filter of the 5th order (with cut-off frequencies 0.15 and 0.35). The related FPScript code is as follows:
Note If Tolerance were to have a value less than half of Jump, then a phase correction by adding or subtracting multiples of Jump would only additionally increase the discontinuity. For instance, if for the Tolerance argument a value less than the half of Jump is specified, Tolerance is automatically corrected by the algorithm to half of the value of Jump.
Available in
FlexPro Basic, Professional, Developer Suite
Examples
PhaseUnwrap({38, 44, 50, 416, 422}, 360) |
Results in the data series {38, 44, 50, 56, 62}. Tolerance is set to the value 360/2 = 180, since the argument was not specified. |
PhaseUnwrap({38, 44, 50, 416, 422}, 360, 140) |
Results in the data series {38, 44, 50, 56, 62}. Tolerance is corrected to the value 180, since 140 is less than 360/2 = 180. |
PhaseUnwrap({38, 44, 50, 416, 422} * 1°) |
Results in the data series {38°, 44°, 50°, 56°, 62°}. The Jump argument was automatically set to the value of 360, since the Phase argument unit is °. |
PhaseUnwrap(Phase(AnalyticSignal(realSig))) |
Unwraps the phase of an analytic signal which is calculated from a real signal. The Jump argument was automatically set to the value TWO_PI, since the Phase function either does not pass a unit or passes the unit rad in its result. |