Engee documentation

peak2rms

The ratio of the peak value to the RMS value.

Library

EngeeDSP

Syntax

Function call

  • y = peak2rms(x) — returns the ratio of the largest absolute value x to the RMS value x.

  • y = peak2rms(x, dim) — calculates the ratio of the peak value x to the RMS value x by measurement dim.

Arguments

Input arguments

# x — input signal

+ vector | the matrix | An N-dimensional array

Details

An input signal specified as a vector, matrix, or multidimensional array.

Типы данных

Float32, Float64

Support for complex numbers

Yes

# dim — the measurement for which the operation is performed

+ scalar

Details

The dimension that the operation is performed on, specified as a positive integer scalar. By default peak2rms works with the first dimension of the array x a dimension greater than 1. For example, if x — row vector or column vector, then y — a real scalar. If x — a matrix of dimension on , where Then y — vector is a string of dimension 1 on , containing the ratio of the peak value to the RMS value of the columns y.

Типы данных

Float32, Float64

Output arguments

# y is the ratio of the peak value to the RMS value

+ scalar | the matrix | An N-dimensional array

Details

The ratio of the peak value to the RMS value, returned as a real scalar, matrix, or multidimensional array.

Examples

The ratio of the peak value to the RMS value for a sine wave

Details

Calculate the ratio of the peak value to the RMS value for 100 Hz sinusoids with sampling frequency 1 kHz.

import EngeeDSP.Functions: peak2rms

t = range(0, stop=1-0.001, step=0.001)
x = cos.(2*pi*100*t)
y = peak2rms(x)

println("y = ", y)
y = 1.414213562373095

The ratio of the peak value to the RMS value for a two-dimensional matrix

Details

Let’s create a matrix in which each column represents a sinusoid with frequency 100 Hz, sampled with frequency 1 kHz, with different amplitudes. The amplitude is equal to the column index.

Calculate the ratio of the peak value to the RMS value of the columns.

import EngeeDSP.Functions: peak2rms

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

println("y = ", y)
y = [1.414213562373095 1.414213562373095 1.4142135623730945 1.414213562373095]

The ratio of the peak value to the RMS value for a two-dimensional matrix along a given dimension

Details

Let’s create a matrix in which each row represents a sinusoid with frequency 100 Hz, sampled with frequency 1 kHz, with different amplitudes. The amplitude is equal to the row index.

Calculate the ratio of the peak value to the RMS value of the columns, specifying the dimension equal to 2, using the argument dim.

import EngeeDSP.Functions: peak2rms

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

y = peak2rms(x, 2)
 1.4142135623730934
 1.4142135623730934
 1.4142135623730963
 1.4142135623730934

The ratio of the peak value to the RMS value for the complex exponent

Details

Let’s create a complex exponent with frequency π/4 rad/countdown. Let’s find the ratio of the peak value to the RMS value.

import EngeeDSP.Functions: peak2rms

n = 0:99
x = exp.(im*pi/4*n)

y = peak2rms(x)
1.0

Additional Info

The ratio of the peak value to the RMS value

Details

The ratio of the peak value to the RMS value is defined as

where the values of the infinite norm and the standard deviation are calculated along the specified measurement.

Literature

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