ToPolar
AnalysisLibErrType ToPolar (double xReal, double xImaginary, double *magnitude, double *phaseRadians);
Purpose
Converts the rectangular coordinates (xReal, xImg) to polar coordinates (magnitude, phase). ToPolar obtains the polar coordinates using the following formulas:
The phase value is in the range [–π : π].
Example Code
// Convert the rectangular coordinates to polar coordinates.
double x, y, mag, phase;
x = 1.5;
y = -2.5;
ToPolar (x, y, &mag, &phase);
Parameters
| Input | ||
| Name | Type | Description |
| x_Real | double | Real part of the complex number that represents the rectangular coordinate. Default Value: 0.0. |
| x_Imaginary | double | Imaginary part of the complex number that represents the rectangular coordinate. Default Value: 0.0. |
| Output | ||
| Name | Type | Description |
| magnitude | double | Magnitude of the resulting polar coordinate. |
| phase_Radians | double | Phase, in radians, of the resulting polar coordinate. phaseRadians value is in the range [–π : π]. |
Return Value
| Name | Type | Description |
| status | AnalysisLibErrType | A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants. |
Additional Information
Library: Analysis Library
Include file: analysis.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later
