dsp.RMS System object

Package: dsp

Root mean square of vector elements


The RMS object computes the root mean square (RMS) value.

To compute the RMS value of your input:

  1. Define and set up your RMS calculation. See Construction.

  2. Call step to compute the RMS value for an input according to the properties of dsp.RMS. The behavior of step is specific to each object in the toolbox.


H = dsp.RMS returns a System object™, H, that computes the root mean square (RMS) of an input or a sequence of inputs over the specified Dimension.

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



Enable calculating RMS over time

Set this property to true to enable calculating the RMS over successive calls to the step method.

Default: false


Enable resetting in running RMS mode

Set this property to true to enable resetting the running RMS. When the property is set to true, you must specify a reset input to the step method to reset the running RMS. This property applies when you set the RunningRMS property to true.

Default: false


Reset condition for running RMS mode

Specify the event to reset the running RMS as one of Rising edge, Falling edge, Either edge, or Non-zero. Non-zero resets the running RMS each time a nonzero sample is acquired. See Rising and Falling Edges for definitions of rising and falling edges. This property applies when you set the ResetInputPort property to true.

Default: Non-zero


Dimension to compute RMS value along

Specify the dimension along which to calculate the RMS as one of All, Row, Column, or Custom. This property applies only when you set the RunningRMS property to false. Specifying the Dimension property as All computes the RMS value over the entire input.

Default: Column


Numerical dimension to operate along

Specify the dimension (one-based scalar integer value) of the input signal, along which the RMS is computed. The cannot exceed the number of dimensions in the input signal. This property applies when you set the Dimension property to Custom.

Default: 1


cloneClones the current instance of the root mean square object
getNumInputsNumber of expected inputs to the step method
getNumOutputsNumber of outputs of the step method
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset the running root mean square object
stepRoot mean square of input


Root-Mean-Square Level

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

with the summation performed along the specified dimension.

Rising and Falling Edges

A rising edge:

  • Rises from a negative value to a positive value or zero.

  • Rises from zero to a positive value, where the rise is not a continuation of a rise from a negative value to zero.

A falling edge:

  • Falls from a positive value to a negative value or zero.

  • Falls from zero to a negative value, where the fall is not a continuation of a fall from a positive value to zero.


expand all

RMS Value of Vector Input

Compute the RMS value of a vector consisting of the integers 1 to 10.

x = 1:10;
hrms = dsp.RMS('Dimension','row');
rmsval = step(hrms,x)
rmsval =


RMS Value of Matrix Input

Compute the RMS value of a matrix with the Dimension property set to 'All'.

in2 = magic(4);
hrms2d = dsp.RMS;
hrms2d.Dimension = 'All';
y_rms2 = step(hrms2d, in2)
y_rms2 =


The output is equivalent to reshaping the 4-by-4 matrix into a 16-by-1, or 1-by-16 vector and computing the RMS value for the vector.


This object implements the algorithm, inputs, and outputs described on the RMS block reference page. The object properties correspond to the Simulink® block parameters, except:

  • Treat sample-based row input as a column block parameter is not supported by the dsp.RMS object.

  • Reset Port block parameter corresponds to both the ResetCondition and the ResetInputPort object properties.

Introduced in R2012a

Was this topic helpful?