Compute the RSS level of a 100 Hz sinusoid sampled at 1 kHz.
t = 0:0.001:1-0.001; x = cos(2*pi*100*t); y = rssq(x)
y = 22.3607
Create a matrix where each column is a 100 Hz sinusoid sampled at 1 kHz with a different amplitude. The amplitude is equal to the column index.
Compute the RSS levels of the columns.
t = 0:0.001:1-0.001; x = cos(2*pi*100*t)'*(1:4); y = rssq(x)
y = 1×4 22.3607 44.7214 67.0820 89.4427
Create a matrix where each row is a 100 Hz sinusoid sampled at 1 kHz with a different amplitude. The amplitude is equal to the row index.
Compute the RSS levels of the rows by specifying the dimension with the
t = 0:0.001:1-0.001; x = (1:4)'*cos(2*pi*100*t); y = rssq(x,2)
y = 4×1 22.3607 44.7214 67.0820 89.4427
x— Input array
Input array, specified as a vector, matrix, or N-D array.
cos(2*pi*100*(0:0.001:1-0.001)) specifies a sinusoid
sampled at 1 kHz for 1 second.
Complex Number Support: Yes
dim— Dimension to operate along
Dimension to operate along, specified as a positive integer scalar.
y— Root-sum-of-squares level
Root-sum-of-squares level, returned as a scalar, vector, matrix, or N-D array.
The root-sum-of-squares (RSS) level of a vector, x, is
with the summation performed along the specified dimension. The RSS level is also referred to as the 2-norm.
 IEEE® Standard on Transitions, Pulses, and Related Waveforms, IEEE Standard 181, 2003.
Usage notes and limitations:
If you supply
dim, then it must be constant.
For limitations related to variable-size inputs, see Variable-Sizing Restrictions for Code Generation of Toolbox Functions (MATLAB Coder).
Code generation does not support sparse matrix inputs for this function.
backgroundPoolor accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.