RunningL2Norm {runstats}R Documentation

Fast Running L2 Norm Computation

Description

Computes running L2 norm between between time-series x and short-time pattern y.

Usage

RunningL2Norm(x, y, circular = FALSE)

Arguments

x

A numeric vector.

y

A numeric vector, of equal or shorter length than x.

circular

logical; whether running L2 norm is computed assuming circular nature of x time-series (see Details).

Details

Computes running L2 norm between between time-series x and short-time pattern y. The length of output vector equals the length of x. Parameter circular determines whether x time-series is assumed to have a circular nature. Assume l_x is the length of time-series x, l_y is the length of short-time pattern y.

If circular equals TRUE then

If circular equals FALSE then

See runstats.demo(func.name = "RunningL2Norm") for a detailed presentation.

Value

A numeric vector.

Examples

## Ex.1.
x <- sin(seq(0, 1, length.out = 1000) * 2 * pi * 6)
y1 <- x[1:100] + rnorm(100)
y2 <- rnorm(100)
out1 <- RunningL2Norm(x, y1)
out2 <- RunningL2Norm(x, y2)
plot(out1, type = "l"); points(out2, col = "blue")
## Ex.2.
x <- sin(seq(0, 1, length.out = 1000) * 2 * pi * 6)
y <- x[1:100] + rnorm(100)
out1 <- RunningL2Norm(x, y, circular = TRUE)
out2 <- RunningL2Norm(x, y, circular = FALSE)
plot(out1, type = "l"); points(out2, col = "red")

[Package runstats version 1.1.0 Index]