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