Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

peak2rms

Peak-magnitude-to-RMS ratio

Syntax

Y = peak2rms(X)
Y = peak2rms(X,DIM)

Description

Y = peak2rms(X) returns the ratio of the largest absolute value in X to the root-mean-square (RMS) value of X. peak2rms operates along the first nonsingleton dimension of X. For example, if X is a row or column vector, Y is a real-valued scalar. If Y 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.

Y = peak2rms(X,DIM) computes the peak-magnitude-to-RMS level of X along the dimension, DIM.

Input Arguments

X

Real– or complex-valued input vector or matrix. By default, peak2rms acts along the first nonsingleton dimension of X.

DIM

Dimension for peak-magnitude-to-RMS ratio. The optional DIM input argument specifies the dimension along which to compute the peak-magnitude-to-RMS level.

Default: First nonsingleton dimension

Output Arguments

Y

Peak-magnitude-to-RMS ratio. For vectors, Y is a real-valued scalar. For matrices, Y contains the peak-magnitude-to-RMS levels computed along the specified dimension, DIM. By default, DIM is the first nonsingleton dimension.

Examples

collapse all

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

Compute the peak-magnitude-to-RMS ratio of a complex exponential with a frequency of rad/sample.

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

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 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.4142    1.4142    1.4142    1.4142

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 RMS levels of the rows specifying the dimension equal to 2 with the DIM argument.

t = 0:0.001:1-0.001;
x = (1:4)'*cos(2*pi*100*t);

y = peak2rms(x,2)
y = 

    1.4142
    1.4142
    1.4142
    1.4142

More About

collapse all

Peak-magnitude-to-RMS Level

The peak-magnitude-to-RMS ratio is

X1Nn=1N|Xn|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™.

See Also

| | | | |

Introduced in R2012a

Was this topic helpful?