Compute the root-mean-square (RMS) of the object x.
rms(x, MARGIN =2)
Arguments
x: the data, expected to be a vector, a matrix, an array.
MARGIN: a vector giving the subscripts which the function will be applied over. E.g., for a matrix 1 indicates rows, 2 indicates columns, c(1, 2) indicates rows and columns. Where x has named dimnames, it can be a character vector selecting dimension names. Default: 2 (columns)
Returns
Vector or array of values containing the root-mean-squares of the specified MARGIN of x.
Details
The input x can be a vector, a matrix or an array. If the input is a vector, a single value is returned representing the root-mean-square of the vector. If the input is a matrix or an array, a vector or an array of values is returned representing the root-mean-square of the dimensions of x
indicated by the MARGIN argument.
Support for complex valued input is provided. The sum of squares of complex numbers is defined by sum(x * Conj(x))