# NOT RUN {
## Construct a list of two templates
template <- list(sin(seq(0, 2 * pi, length.out = 100)),
cos(seq(0, 2 * pi, length.out = 100)))
## A grid of vector lengths to which each of templates is scaled into
template.vl <- c(50, 100, 200)
## Compute list of rescaled templates
out <- scaleTemplate(template, template.vl)
## Plot 1st template after rescaling to three values of vector length
par(mfrow = c(2, 1), cex = 0.7)
plot(out[[3]][[1]], type = "l",
main = "Pattern: sin([0, 2 * pi]) rescaled according to different scales",
ylab = "Pattern", xlab = "Index")
lines(out[[2]][[1]], col = "red")
lines(out[[1]][[1]], col = "blue")
## Plot 2nd template after rescaling to three values of vector length
plot(out[[3]][[2]], type = "l",
main = "Pattern: cos([0, 2 * pi]) rescaled according to different scales",
ylab = "Pattern", xlab = "Index")
lines(out[[2]][[2]], col = "red")
lines(out[[1]][[2]], col = "blue")
# }
Run the code above in your browser using DataLab