Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

peak2rms

Peak-magnitude-to-RMS ratio


Description

Compute the ratio of the largest absolute value to the root-mean-square (RMS) value of the object x.

Usage

peak2rms(x, MARGIN = 2)

Arguments

x

the data, expected to be a vector, a matrix, an array.

MARGIN

a vector giving the subscripts which the function will be applied over. E.g., for a matrix 1 indicates rows, 2 indicates columns, c(1, 2) indicates rows and columns. Where x has named dimnames, it can be a character vector selecting dimension names. Default: 2 (usually columns)

Details

The input x can be a vector, a matrix or an array. If the input is a vector, a single value is returned representing the peak-magnitude-to-RMS ratio of the vector. If the input is a matrix or an array, a vector or an array of values is returned representing the peak-magnitude-to-RMS ratios of the dimensions of x indicated by the MARGIN argument.

Support for complex valued input is provided.

Value

Vector or array of values containing the peak-magnitude-to-RMS ratios of the specified MARGIN of x.

Author(s)

Andreas Weber, octave@tech-chat.de.
Conversion to R by Geert van Boxtel G.J.M.vanBoxtel@gmail.com.

Examples

## numeric vector
x <- c(1:5)
p <- peak2rms(x)

## numeric matrix
x <- matrix(c(1,2,3, 100, 150, 200, 1000, 1500, 2000), 3, 3)
p <- peak2rms(x)
p <- peak2rms(x, 1)

## numeric array
x <- array(c(1, 1.5, 2, 100, 150, 200, 1000, 1500, 2000,
           10000, 15000, 20000), c(2,3,2))
p <- peak2rms(x, 1)
p <- peak2rms(x, 2)
p <- peak2rms(x, 3)

## complex input
x <- c(1+1i, 2+3i, 3+5i, 4+7i, 5+9i)
p <- peak2rms(x)

gsignal

Signal Processing

v0.3-1
GPL-3
Authors
Geert van Boxtel [aut, cre] (Maintainer), Tom Short [aut] (Author of 'signal' package), Paul Kienzle [aut] (Majority of the original sources), Ben Abbott [ctb], Juan Aguado [ctb], Muthiah Annamalai [ctb], Leonardo Araujo [ctb], William Asquith [ctb], David Bateman [ctb], David Billinghurst [ctb], Juan Pablo Carbajal [ctb], André Carezia [ctb], Vincent Cautaerts [ctb], Eric Chassande-Mottin [ctb], Luca Citi [ctb], Dave Cogdell [ctb], Carlo de Falco [ctb], Carne Draug [ctb], Pascal Dupuis [ctb], John W. Eaton [ctb], R.G.H Eschauzier [ctb], Andrew Fitting [ctb], Alan J. Greenberger [ctb], Mike Gross [ctb], Daniel Gunyan [ctb], Kai Habel [ctb], Kurt Hornik [ctb], Jake Janovetz [ctb], Alexander Klein [ctb], Peter V. Lanspeary [ctb], Bill Lash [ctb], Friedrich Leissh [ctb], Laurent S. Mazet [ctb], Mike Miller [ctb], Petr Mikulik [ctb], Paolo Neis [ctb], Georgios Ouzounis [ctb], Sylvain Pelissier [ctb], Francesco Potortì [ctb], Charles Praplan [ctb], Lukas F. Reichlin [ctb], Tony Richardson [ctb], Asbjorn Sabo [ctb], Thomas Sailer [ctb], Rolf Schirmacher [ctb], Rolf Schirmacher [ctb], Ivan Selesnick [ctb], Julius O. Smith III [ctb], Peter L. Soendergaard [ctb], Quentin Spencer [ctb], Doug Stewart [ctb], P. Sudeepam [ctb], Stefan van der Walt [ctb], Andreas Weber [ctb], P. Sudeepam [ctb], Andreas Weingessel [ctb]
Initial release
2021-05-02

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.