envelope: Calculates the envelope of a band limited signal

Description Usage Arguments Details Value Examples

View source: R/envelope.R

Description

The envelope of an amplitude modulated signal can be calculated by using the Hilbert transform H(y) of the signal or the analytic signal.

Usage

1

Arguments

y

numeric vector of the signal

Details

An amplitude modulated function y(x) = A(x) * cos(ω * x) can be demodulated as follows:

A(x)^2 = y(x)^2 + H(y(x))^2

If the signal is not band limited, strange things can happen. See the ripple at the edges in the example below. Pay attention, that the envelope is always the real part of the returned value.

Value

real valued envelope function of the signal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## noisy signal with amplitude modulation
x <- seq(0,1, length.out=2e2)

# original data
y <- (abs(x-0.5))*sin(20*2*pi*x)

ye <- base::Re(envelope(y))

# plot results
plot(x,y,type="l",lwd=1,col="darkgrey",lty=2,ylab="y",main="Spectral filtering")
lines(x,ye)
legend("bottomright",c("modulated","envelope"),col=c("grey","black"),lty=c(2,1))

Example output

Loading required package: rasterImage
Loading required package: plotrix

spectral documentation built on March 29, 2021, 5:10 p.m.

Related to envelope in spectral...