Skip to contents

Successively notches the fundamental and its first n_harmonics harmonics. Each notch below Nyquist is applied; aliased harmonics are skipped.

Usage

morie_dsp_comb(x, fundamental, fs, n_harmonics = 5L, q = 30)

Arguments

x

Numeric vector.

fundamental

Fundamental frequency (Hz), e.g. 60 for North American mains.

fs

Sampling frequency (Hz).

n_harmonics

Number of harmonics to cancel. Default 5.

q

Quality factor per notch. Default 30.

Value

Filtered vector, length(x).

References

Rangayyan & Krishnan (2015), Ch. 3, sec. 3.7.

Examples

fs <- 1000
t <- seq.int(0, fs - 1L) / fs
x <- sin(2 * pi * 50 * t) + 0.5 * sin(2 * pi * 100 * t)
y <- morie_dsp_comb(x, fundamental = 50, fs = fs, n_harmonics = 2L)
head(y)
#> [1] -0.001813811  0.258838830  0.454721928  0.548451983  0.534366968
#> [6]  0.437086285