rms
Root Mean Square (RMS) of array elements.
📝 Syntax
y = rms(x)
y = rms(x, dim)
y = rms(x, vecdim)
y = rms(x, 'all')
y = rms(x, dim, type)
y = rms(x, 'all', type)
y = rms(x, dim, type, nanflag)
y = rms(x, 'all', type, nanflag)
📥 Input argument
x - Input array, specified as a vector, matrix, or multidimensional array: single, double, logical, integer types
dim - Dimension to operate along, specified as a positive integer scalar.
'all' - Operate on all elements of x, returning the RMS value of all elements.
type - Data type to use in the computation: 'double', 'native'
nanflag - Missing value condition, specified as: 'includenan', 'includemissing', 'omitnan', 'omitmissing'
📤 Output argument
y - Root mean square value(s), returned as a scalar, vector, or array.
📄 Description
rms returns the root mean square (RMS) value of the input array elements.
If x is a vector, y is a scalar.
If x is a matrix, y is a row vector containing the RMS value for each column (default).
If x is a multidimensional array, y contains the RMS values computed along the first array dimension whose size does not equal 1, unless another dimension is specified.
The root mean square value of an array x is: where the summation is performed along the specified dimension(s), and N is the number of elements along those dimensions.
NaN Handling: By default, NaN values are included. Use 'omitnan' or 'omitmissing' to ignore NaNs.
Type Handling: If type is 'native', the computation and output use the same class as the input (e.g., integer input returns integer output).
💡 Examples
RMS Value of Vector
RMS Values of Matrix Columns
RMS Values of Matrix Rows
RMS Excluding Missing Values
RMS with Integer Input and Native Output
🔗 See also
🕔 History
1.16.0
initial version
Last updated
Was this helpful?