rms

Root-mean-square level of a signal.

Category: Data Import and Analysis > Descriptive Statistics

Syntax

y = rms(x)

RMS of a vector, or of each column of a matrix.

y = rms(x, dim)

Along dimension dim.

Description

The RMS value squares each element, averages, and takes the square root. Because of the squaring it is never negative and it weighs large values more than the mean absolute value does. For a signal centered on zero it equals the standard deviation (with divisor N); in electrical work it is the effective value of an alternating signal.

Complex elements are handled through their magnitude.

Input arguments

x
Numeric array.
dim
Dimension to operate along.

Output arguments

y
sqrt(mean(abs(x).^2)) along the chosen dimension.

Example

RMS of a vector and of matrix rows

rms([3 4])
A = [1 5; 3 2; 4 9];
rms(A, 2)
Output
ans = 3.5355
ans = 3×1

    3.6056
    2.5495
    6.9642

See also

mean std norm rmse