rms

Syntax

rms(X)

Arguments

X can be a numeric scalar, pair, vector, matrix, or table.

Details

Calculate the root mean square value of input X. Its formula is as follows:

Return Value

  • If X is a scalar, pair, or vector, it returns a scalar.
  • If X is a matrix, it returns a vector, with each element representing the RMS value of a column.
  • If X is a table, it returns a single-row table, where each column contains the RMS value for that corresponding column.

Examples

Example 1: when X is a vector

X=[1,2,3,4,5]
rms(X)
// output: 3.317

Example 2: when X is a matix

X=matrix(1 2 3, 4 5 6)
rms(X)
// output: [2.160,5.066]

Example 3: when X is a table

X=1 2 3 4 5 6
Y=7 8 9 10 11 12
t=table(X as val1, Y as val2)
rms(t)

Output:

val1 val2
3.894 9.652