View Raw SPL
/*****************************************************************************
* *
* COLRMS.SPL Copyright (C) 2014 DSP Development Corporation *
* All Rights Reserved *
* *
* Author: Randy Race *
* *
* Synopsis: Calculates the RMS of each column of a series *
* *
* Revisions: 21 Jul 2014 RRR Creation - from RMS.MAC *
* *
*****************************************************************************/
#if @HELP_COLRMS
COLRMS
Purpose: Calculates the root mean squared of each column of an array.
Syntax: COLRMS(x)
x - input array
Returns: A series, the RMS of each column of the input array.
Example:
a = {{1, 2, 3},
{4, 5, 6},
{7, 8, 9}}
b = colrms(a)
b == {{4.690416}, {5.567764}, {6.480741}}
Example:
W1: gsin(100, .01, 1)
W2: 1..10
W3: ravel(w1, w2)
W4: colrms(w3)
W4 == {{0.707107}, {6.204837}}
See Also:
Colstdev
Movrms
RMS
#endif
/* RMS of each column */
ITERATE colrms(s)
{
local r;
if (argc < 1) error(sprintf("%s - input series required", __FUNC__));
/* single point series */
r = {RMS(s)};
/* units */
setvunits(r, getzunits(s));
sethunits(r, gethunits(s));
return(r);
}