National Instruments 320682C Musical Toy Instrument User Manual


 
Chapter 3 Analysis Library
© National Instruments Corporation 3-33 LabWindows/CVI Standard Libraries
Parameters
Input
xReal
double-precision X coordinate.
yImaginary
double-precision X coordinate.
Output
magnitude
double-precision Magnitude.
phaseRadians
double-precision Phase (in radians).
Return Value
status
integer Refer to error codes in
Table 3-2.
ToPolar1D
int status = ToPolar1D (double arrayXReal[], double arrayYImaginary[],
int numberofElements, double magnitude[],
double phaseRadians[]);
Purpose
Converts the set of rectangular coordinate points (arrayXReal, arrayYImaginary) to a set of
polar coordinate points (magnitude, phaseRadians). The function obtains the ith element of the
polar coordinate set by using the following formulas.
mag x y
iii
=+
22
phase
i
= arctan y
i
/ x
i
The phaseRadians value is in the range of [ -π to π ].
The function performs the operations in place; that is, arrayXReal and magnitude, and
arrayYImaginary and phaseRadians, can be the same arrays, respectively.