Rectpolar (dest, source), Rmsspa(dest, swath, source), Swath i x dest – Campbell Scientific CR9000X Measurement and Control System User Manual
Page 317

Section 8. Processing and Math Instructions
RectPolar (Dest, Source)
Converts from rectangular to polar coordinates. The vector length will be
returned to the array element specified in Dest(1); the angle in radians will be
returned in the array element specified in Dest(2).
If it is desired to use degrees
instead of radians for the inputs and results of the trig functions in a program,
the "AngleDegrees" declaration instruction can be used.
Parameter
& Data Type
Enter
RECTPOLAR PARAMETERS
Dest
Variable
array
Variable array in which to store the 2 resultant values. The length of the vector is stored in the
specified destination element and the angle, in radians(±
π
), in the next element of the array
Source
Variable
Array
The variable array containing the X and Y coordinates to convert to Polar coordinates. The X
value must be in the specified array element and the Y value in the next element of the array.
Example: In the following example, a counter (Deg) is incremented from 0 to
360 degrees. The cosine and sine of the angle are taken to get X and Y in
rectangular coordinates. RectPolar is then used to convert to polar coordinates.
Dim XY(2),Polar(2),Deg,AnglDeg
Const Pi=4*ATN(1)
Alias XY(1)=X : Alias XY(2)=Y : Alias Polar(1)=Length : Alias Polar(2)=AnglRad
DataTable(RtoP,1,500)
Sample(1,Deg,IEEE4)
Sample(2,XY,IEEE4)
Sample(2,Polar,IEEE4)
Sample(1,AnglDeg,IEEE4)
EndTable
BeginProg
For Deg=0 to 360
XY(1)=Cos(Deg*Pi/180)
‘
Cos and Sin operate on radians
XY(2)=Sin(Deg*Pi/180)
RECTPOLAR
(Polar,XY)
AnglDeg=Polar(2)*180/Pi
‘
Convert angle to degrees
CallTable RtoP
Next Deg
EndProg
RMSSpa(Dest, Swath, Source)
Used to compute the RMS value of an array.
Syntax
RMSSpa(
Dest, Swath, Source
)
Remarks
Spatial RMS, calculates the root mean square of values in an array.
NANs are not
included in the processing of the Spatial RMS.
(
)
swath
i
X
Dest
swath
j
i
j
i
∑
−
+
=
=
=
1
2
)
(
Where X(j) = Source
8-31