# 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.

# dsp.PeakToRMS System object

Peak-to-root-mean-square value of vector

## Description

The `PeakToRMS` object calculates the peak-to-root-mean-square ratio of a vector.

To compute the peak-to-root-mean-square ratio:

1. Define and set up your peak-to-root-mean-square calculation. See Construction.

2. Call `step` to calculate the peak-to-root-mean-square value for an input vector according to the properties of `dsp.PeakToRMS`. The behavior of `step` is specific to each object in the toolbox.

### Note

Starting in R2016b, instead of using the `step` method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, ```y = step(obj,x)``` and `y = obj(x)` perform equivalent operations.

## Construction

`ptr = dsp.PeakToRMS` creates a peak-to-root-mean-square System object, `ptr`, that returns the ratio of the maximum magnitude (peak) to the root-mean-square (RMS) value in an input or a sequence of inputs.

`ptr = dsp.PeakToRMS('PropertyName',PropertyValue,...)` returns an `PeakToRMS` System object, `ptr`, with each specified property set to the specified value.

## Properties

 `CustomDimension` Numerical dimension to operate along. Specify the dimension as a positive integer along which the peak-to-RMS ratio is computed. The value of this property cannot exceed the number of dimensions in the input signal. This property applies when `Dimension` property is `'Custom'`. Default: `1` `DecibelScaledOutput` Report output in decibels (dB). Set this property to `true` to enable output in dB. Set this property to `false` to report output as a ratio. Default: `true` `Dimension` Dimension to operate along. Specify the dimension along which to calculate the peak-to-RMS ratio as one of `'All'`, `'Row'`, `'Column'`, or `'Custom'`. This property applies when the `RunningPeakToRMS` property is `false`. If you set this property to `'Custom'`, specify the dimension using the `CustomDimension` property. Default: `'Column'` `ResetCondition` Reset condition for running peak-to-RMS mode. Specify the event to reset the running peak-to-RMS as one of `'Rising edge'`, ```'Falling edge'```, `'Either edge'`, or `'Non-zero'`. This property applies when the `ResetInputPort` property is `true`. `ResetInputPort` Enables resetting in running peak-to-RMS mode. Set this property to `true` to enable resetting. When the property is set to `true`, a reset input must be specified in the call to `step` to reset the running peak-to-RMS ratio. This property applies when the `RunningPeakToRMS` property is `true`. Default: `false` `RunningPeakToRMS` Calculation over successive calls to `step`. Set this property to `true` to enable the calculation of the peak-to-RMS ratio over successive calls to the `step`. Default: `false`

## Methods

 reset Reset the running peak-to-root-mean-square object step Compute peak-to-RMS ratio
Common to All System Objects
`clone`

Create System object with same property values

`getNumInputs`

Expected number of inputs to a System object

`getNumOutputs`

Expected number of outputs of a System object

`isLocked`

Check locked states of a System object (logical)

`release`

Allow System object property value changes

## Examples

expand all

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent `step` syntax. For example, myObject(x) becomes step(myObject,x).

Determine the peak-to-RMS ratio of a vector input.

```in = (1:10)'; ptr = dsp.PeakToRMS; y = ptr(in)```
```y = 1.6116 ```

Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent `step` syntax. For example, myObject(x) becomes step(myObject,x).

Determine the peak-to-RMS ratio of a matrix input.

```in = magic(4); ptr = dsp.PeakToRMS; ptr.Dimension = 'All'; y = ptr(in)```
```y = 1.6547 ```

expand all

## References

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