Documentation

RMS

Root-mean-square level

Description

example

y= rms(x)returns the root-mean-square (RMS) level of the input,x。如果xis a row or column vector,yis a real-valued scalar. For matrices,ycontains the RMS levels computed along the first array dimension of x with size greater than 1. For example, ifxis anN-by-Mmatrix withN> 1, thenyis a 1-by-Mrow vector containing the RMS levels of the columns ofx

example

y= rms(x,dim)computes the RMS level ofx沿尺寸dim

Examples

collapse all

计算以1 kHz采样的100 Hz正弦曲线的RMS水平。

t = 0:0.001:1-0.001; x = cos(2*pi*100*t); y = rms(x)
y = 0.7071

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.

计算列的RMS级别。

t = 0:0.001:1-0.001; x = cos(2*pi*100*t)'*(1:4); y = rms(x)
y =1×40.7071 1.4142 2.1213 2.8284

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 thedim争论。

t = 0:0.001:1-0.001; x = (1:4)'*cos(2*pi*100*t); y = rms(x,2)
y =4×10.7071 1.4142 2.1213 2.8284

Input Arguments

collapse all

Input array, specified as a vector, matrix, N-D array, orgpuArray目的。By default,RMSacts along the first array dimension ofXwith size greater than 1.

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

Example:cos(pi/4*(0:159))+randn(1,160)is a single-channel row-vector signal.

Example:cos(pi./[4;2]*(0:159))'+randn(160,2)是两个通道信号。

Data Types:single|double
Complex Number Support:Yes

沿着计算RMS级别的维度, specified as an integer scalar.

Data Types:single|double

Output Arguments

collapse all

根平方级别,返回为实值标量,向量,n-d数组或gpuArray目的。如果xis a vector, thenyis a real-valued scalar. Ifx是矩阵,然后y包含沿维度计算的RMS级别dim。By default,dimis the first array dimension ofxwith size greater than 1.

More About

collapse all

根平方水平

The root-mean-square level of a vectorxis

x RMS = 1 N n = 1 N | x n | 2 ,

与执行的总和along the specified dimension.

参考

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

Extended Capabilities

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

Introduced in R2012a