Peak-Magnitude-to-RMS Ratio of Sinusoid
Compute the peak-magnitude-to-RMS ratio of a 100 Hz sinusoid sampled at 1 kHz.
t = 0:0.001:1-0.001; x = cos(2*pi*100*t); y = peak2rms(x)
y = 1.4142
Peak-Magnitude-to-RMS Ratio of Complex Exponential
Create a complex exponential with a frequency of rad/sample. Find the peak-magnitude-to-RMS ratio.
n = 0:99; x = exp(1j*pi/4*n); y = peak2rms(x)
y = 1
Peak-Magnitude-to-RMS Ratios of 2-D Matrix
Create a matrix in which 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 peak-magnitude-to-RMS ratios of the columns.
t = 0:0.001:1-0.001; x = cos(2*pi*100*t)'*(1:4); y = peak2rms(x)
y = 1×4 1.4142 1.4142 1.4142 1.4142
Peak-Magnitude-to-RMS Ratios of 2-D Matrix Along Specified Dimension
Create a matrix in which 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 RMS levels of the rows, specifying the dimension equal to 2 with the
t = 0:0.001:1-0.001; x = (1:4)'*cos(2*pi*100*t); y = peak2rms(x,2)
y = 4×1 1.4142 1.4142 1.4142 1.4142
x — Input array
vector | matrix | N-D array |
Input signal, specified as a vector, matrix, N-D array, or
Complex Number Support: Yes
dim — Dimension to operate along
positive integer scalar
Dimension to operate along, specified as a positive integer scalar. By default,
peak2rms operates along the first array dimension of
x with size greater than 1. For example, if
x is a row or column vector,
y is a
real-valued scalar. If
x is an
N-by-M matrix with
N > 1,
y is a
1-by-M row vector containing the peak-magnitude-to-RMS levels of
the columns of
y — Peak-magnitude-to-RMS-ratio
scalar | matrix | N-D array |
Peak-magnitude-to-RMS ratio, specified as a real-valued scalar, matrix,
N-D array, or
The peak-magnitude-to-RMS ratio is
where the infinity-norm and RMS values are computed along the specified dimension.
 IEEE® Standard on Transitions, Pulses, and Related Waveforms, IEEE Standard 181, 2003.
Calculate with arrays that have more rows than fit in memory.
This function fully supports tall arrays. For more information, see Tall Arrays.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Run code in the background using MATLAB®
backgroundPool or accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).