Root mean square.
g=rms(f)
g=rms(f,'linlog')
g=rms(f,MODE)
SQRT takes the square root of the imat_fnM. NUM must be a scalar. Complex results are produced if F is not positive.
RMS calculates the root mean square value of the supplied imat_fn. For evenly spaced functions the formula used is
rms = sqrt( 1/length(y) * sum(y.^2) );
Note that when F is unevenly spaced, RMS will use the formula based on the formula for a continuous function,
rms = sqrt(1./(x(end)-x(1)) * sum((y.^2).*[0; diff(x)]))
This can cause differences in the RMS value calculated versus an equivalent evenly spaced function.
If the function in F is a frequency domain function and is a spectrum (any type) or frequency response function, RMS will be calculated in one of several ways. The AmplitudeUnits and Normalization attributes become very important. Unfortunately, I-deas and NX do not set these attributes properly, so in this case if the FunctionType is Power Spectral Density and the AmplitudeUnits and Normalization are Unknown, RMS will assume 'RMS' and 'Units squared/Hz'.
If the AmplitudeUnits attribute is 'Peak', the calculated RMS value from the above formulas will be multiplied by 1/sqrt(2). If it is 'Half-Peak', it will be multiplied by sqrt(2).
If the Normalization is 'Units squared/Hz', the RMS is calculated by taking the square root area under the curve. Otherwise, the bandwidth (delta F) is not used in the calculation. For unevenly spaced functions, the trapezoidal rule is used to get the area under the curve. Otherwise, the absolute value of the ordinate values are summed.
RMS values for linear amplitude functions such as spectra and FRF are calculated by taking the square root of the sum of the absolute values of the amplitude squared.
RMS determines whether the frequency domain function is linear or squared by looking at Normalization and OrdNumTypeQual. If either of these attributes contain the word 'squared', or FunctionType is Power Spectral Density, Auto Spectrum, or Cross Spectrum, the units are considered to be squared.
MODE is an optional input string specifying the interpolation type to use. Valid options are 'linlin' (default), 'linlog', 'loglin', and 'loglog'.