View Raw SPL
/*****************************************************************************
* *
* RAD2DEG.SPL Copyright (C) 2022 DSP Development Corporation *
* All Rights Reserved *
* *
* Author: Randy Race *
* *
* Synopsis: Converts input in radians to degrees *
* *
* Revisions: 7 Mar 2022 RRR Creation *
* *
* *
*****************************************************************************/
#if @HELP_RAD2DEG
RAD2DEG
Purpose: Converts the input in radians to degrees.
Syntax: RAD2DEG(x)
x - A scalar or series, the radian input.
Returns: A scalar or series, the result in degrees.
Example:
rad2deg(pi/4)
returns 45.
Example:
W1: {0, pi/4, pi/3, pi/2, pi}
W2: rad2deg(w1)
W2 == {0, 45, 60, 90, 180}, the radian values of W1 converted
to degrees.
Remarks:
If the input is a series, the vertical units are set to
"degrees".
See Also:
Deg
Deg2rad
Setdegree
#endif
/* convert radians to degrees */
rad2deg(x)
{
local y;
if (argc < 1) error(sprintf("%s - input required", __FUNC__));
y = x * 180 / pi;
if (isarray(y))
{
setvunits(y, "Degrees");
}
return(y);
}