Skip to contents

Slides template across x, computing the centred Pearson-style correlation per offset. Returns indices and correlation values meeting threshold.

Usage

morie_dsp_template_match(x, template, threshold = 0.7)

Arguments

x

Numeric vector.

template

Numeric vector (shorter than x).

threshold

Minimum correlation. Default 0.7.

Value

List with indices (1-based) and correlations.

References

Rangayyan & Krishnan (2015), Ch. 4, sec. 4.4.

Examples

set.seed(1L)
tpl <- c(0, 1, 2, 1, 0)
x <- c(rnorm(15, sd = 0.01), tpl, rnorm(15, sd = 0.01))
out <- morie_dsp_template_match(x, tpl, threshold = 0.7)
out$indices
#> [1]  6 16 29