# dsp.PeakToRMS System object

Package: dsp

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.

## Construction

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

H = dsp.PeakToRMS('PropertyName',PropertyValue,...) returns an PeakToRMS System object, H, 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

 clone Clones the current instance of the peak-to-root-mean-square object getNumInputs Number of expected inputs to the step method getNumOutputs Number of outputs of the step method isLocked Locked status (logical) for input attributes and nontunable properties release Allow property value and input characteristics changes reset Reset the running peak-to-root-mean-square object step Compute peak-to-RMS ratio

## Definitions

### Peak-magnitude-to-RMS Level

The peak-magnitude-to-RMS level is

$\frac{||X|{|}_{\infty }}{\sqrt{\frac{1}{N}\sum _{n=1}^{N}|{X}_{n}{|}^{2}}}$

where the l-infinity norm and RMS values are computed along the specified dimension.

## Examples

collapse all

### Peak-to-RMS Ratio of Vector Input

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

in1 = (1:10)';
h1 = dsp.PeakToRMS;
y1 = step(h1,in1);

### Peak-to-RMS Ratio of Matrix Input

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

in2 = magic(4);
h2 = dsp.PeakToRMS;
h2.Dimension = 'All';
y2 = step(h2, in2)

## References

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