# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

# rms

Root-mean-square level

## Syntax

`Y = rms(X)Y = rms(X,DIM)`

## Description

`Y = rms(X)` returns the root-mean-square (RMS) level of the input, `X`. If `X` is a row or column vector, `Y` is a real-valued scalar. For matrices, `Y` contains the RMS levels computed along the first nonsingleton dimension. For example, if `X` is an N-by-M matrix with N > 1, `Y` is a 1-by-M row vector containing the RMS levels of the columns of `X`.

`Y = rms(X,DIM)` computes the RMS level of `X` along the dimension, `DIM`.

## Input Arguments

 `X` Real or complex-valued input vector or matrix. By default, `rms` acts along the first nonsingleton dimension of `X`. `DIM` Dimension for RMS levels. The optional `DIM` input argument specifies the dimension along which to compute the RMS levels. Default: First nonsingleton dimension

## Output Arguments

 `Y` Root-mean-square level. For vectors, `Y` is a real-valued scalar. For matrices, `Y` contains the RMS levels computed along the specified dimension `DIM`. By default, `DIM` is the first nonsingleton dimension.

## Examples

collapse all

Compute the RMS level of a 100 Hz sinusoid sampled at 1 kHz.

```t = 0:0.001:1-0.001; x = cos(2*pi*100*t); y = rms(x) ```
```y = 0.7071 ```

Create a matrix where each column is a 100 Hz sinusoid sampled at 1 kHz with a different amplitude. The amplitude is equal to the column index.

Compute the RMS levels of the columns.

```t = 0:0.001:1-0.001; x = cos(2*pi*100*t)'*(1:4); y = rms(x) ```
```y = 0.7071 1.4142 2.1213 2.8284 ```

Create a matrix where each row is a 100 Hz sinusoid sampled at 1 kHz with a different amplitude. The amplitude is equal to the row index.

Compute the RMS levels of the rows specifying the dimension equal to 2 with the `DIM` argument.

```t = 0:0.001:1-0.001; x = (1:4)'*cos(2*pi*100*t); y = rms(x,2) ```
```y = 0.7071 1.4142 2.1213 2.8284 ```

collapse all

### Root-Mean-Square Level

The root-mean-square level of a vector, X, is

`${X}_{\text{RMS}}=\sqrt{\frac{1}{N}\sum _{n=1}^{N}{|{X}_{n}|}^{2}},$`

with the summation performed along the specified dimension.

## References

[1] IEEE® Standard on Transitions, Pulses, and Related Waveforms, IEEE Std 181, 2003.