# Documentation

### This is machine translation

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

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

# rms

Root-mean-square level

## Syntax

``y = rms(x)``
``y = rms(x,dim)``

## Description

example

````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 array dimension of x with size greater than 1. For example, if `x` is an N-by-M matrix with N > 1, then `y` is a 1-by-M row vector containing the RMS levels of the columns of `x`.```

example

````y = rms(x,dim)` computes the RMS level of `x` along the dimension `dim`.```

## 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 in which 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 in which 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 ```

## Input Arguments

collapse all

Input array, specified as a vector, matrix, or N-D array. By default, `rms` acts along the first array dimension of `X` with size greater than 1.

Example: `cos(pi/4*(0:159))+randn(1,160)` is a single-channel row-vector signal.

Example: `cos(pi./[4;2]*(0:159))'+randn(160,2)` is a two-channel signal.

Data Types: `single` | `double`
Complex Number Support: Yes

Dimension along which to compute RMS levels, specified as an integer scalar.

Data Types: `single` | `double`

## Output Arguments

collapse all

Root-mean-square level, returned as a real-valued scalar, vector, or N-D array. If `x` is a vector, then `y` is a real-valued scalar. If `x` is a matrix, then `y` contains the RMS levels computed along dimension `dim`. By default, `dim` is the first array dimension of `x` with size greater than 1.

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 Std 181. IEEE® Standard on Transitions, Pulses, and Related Waveforms. 2003.