Root mean square of vector elements
The RMS object computes the root mean square (RMS) value.
To compute the RMS value of your input:
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.
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.
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.
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.
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.
Enable frame-based processing
Set this property to true to enable frame-based processing for 2-dimensional inputs. Set this property to false to enable sample-based processing. The object always performs sample-based processing for N-D inputs where N is greater than 2. This property applies when you set the RunningRMS property to true.
|clone||Clones the current instance of the root mean square object|
|getNumInputs||Number of expected inputs to the step method|
|getNumOutputs||Number of outputs of the step method|
|isLocked||Locked status for input attributes and nontunable properties|
|release||Allow property value and input characteristics changes|
|reset||Reset the running root mean square object|
|step||Root mean square of input|
The root-mean-square level of a vector, X, is
with the summation performed along the specified dimension.
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.
Compute the RMS value of a vector consisting of the integers 1 to 10.
Create a row vector of the integers 1 to 10. Construct the RMS System object with the Dimension property set to 'literal'. Compute the RMS value.
x = 1:10; hrms = dsp.RMS('Dimension','row'); rmsval = step(hrms,x);
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);
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.
Both this object and its corresponding block let you specify whether to process inputs as individual samples or as frames of data. The object uses the FrameBasedProcessing property. The block uses the Input processing parameter. See Set the FrameBasedProcessing Property of a System object for more information.