Documentation

peak2rms

Peak-magnitude-to-RMS ratio

Description

example

y= peak2rms(x)returns the ratio of the largest absolute value inxto the root-mean-square (RMS) value ofx.

example

y= peak2rms(x,dim)computes the peak-magnitude-to-RMS ratio ofxalong dimensiondim.

Examples

collapse all

计算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

Create a complex exponential with a frequency of π / 4 rad/sample. Find the peak-magnitude-to-RMS ratio.

n = 0:99; x = exp(1j*pi/4*n); y = peak2rms(x)
y = 1

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.

计算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×41.4142 1.4142 1.4142 1.4142

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.

计算RMS levels of the rows, specifying the dimension equal to 2 with thedimargument.

t = 0:0.001:1-0.001; x = (1:4)'*cos(2*pi*100*t); y = peak2rms(x,2)
y =4×11.4142 1.4142 1.4142 1.4142

Input Arguments

collapse all

Input signal, specified as a vector, matrix,N-D array, orgpuArrayobject.

SeeRun MATLAB Functions on a GPU(Parallel Computing Toolbox) andGPU Support by Release(Parallel Computing Toolbox) for details ongpuArrayobjects.

Data Types:double|single
Complex Number Support:Yes

Dimension to operate along, specified as a positive integer scalar. By default,peak2rmsoperates along the first array dimension ofxwith size greater than 1. For example, ifxis a row or column vector,yis a real-valued scalar. Ifxis anN-by-Mmatrix withN> 1,yis a 1-by-Mrow vector containing the peak-magnitude-to-RMS levels of the columns ofy.

Data Types:double|single

Output Arguments

collapse all

Peak-magnitude-to-RMS ratio, specified as a real-valued scalar, matrix,N-D array, orgpuArrayobject.

More About

collapse all

Peak-Magnitude-to-RMS Ratio

The peak-magnitude-to-RMS ratio is

X 1 N n = 1 N | X n | 2 ,

where the-infinity norm and RMS values are computed along the specified dimension.

References

[1]IEEE®Standard on Transitions, Pulses, and Related Waveforms, IEEE Standard 181, 2003.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced in R2012a