rescale: Signal Normalization

rescaleR Documentation

Signal Normalization

Description

Normalize or rescale a signal.

Usage

# Rescale the root-mean-squared of the signal
rescale_rms(x, scale = 1)

# Rescale the sum of (absolute values of) the signal
rescale_sum(x, scale = length(x))

# Rescale according to a specific sample
rescale_ref(x, ref = 1L, scale = 1, domain = NULL)

# Rescale the lower and upper limits of the signal
rescale_range(x, limits = c(0, 1))

# Rescale the interquartile range
rescale_iqr(x, width = 1, center = 0)

Arguments

x

A numeric vector.

scale

The scaling value.

ref

The sample (index or domain value) to use.

domain

The domain variable of the signal.

limits

The lower and upper limits to use.

width

The interquartile range to use.

center

The center to use.

Details

rescale_rms() and rescale_sum() simply divide the signal by its root-mean-square or absolute sum, respectively, before multiplying by the given scaling factor.

rescale_ref() finds the closest matching sample to ref in domain if given (it is treated as an index if domain is NULL), and then scales the entire signal to make that sample equal to scale.

rescale_range() simply rescales the signal to match the given upper and lower limits.

rescale_iqr() attempts to rescale the signal so that its interquartile range is approximately width.

Value

A rescaled numeric vector the same length as x.

Author(s)

Kylie A. Bemis

Examples

set.seed(1)
x <- rnorm(100)

sqrt(mean(x^2))
y <- rescale_rms(x, 1)
sqrt(mean(y^2))

range(x)
z <- rescale_range(x, c(-1, 1))
range(z)

kuwisdelu/matter documentation built on Oct. 19, 2024, 10:31 a.m.