#---- simulate with numeric trend, and spec a wd object as in wavethresh-----
spec <- wavethresh::cns(1024)
spec <- wavethresh::putD(spec, level = 8, seq(from = 2, to = 8, length = 1024))
trend <- sin(pi * (seq(from = 0, to = 4, length = 1024)))
x <- TLSWsim(trend = trend, spec = spec)
plot.ts(x)
#---- simulate with numeric trend, and spec a matrix, with non-dyadic n-----
spec <- matrix(0, nrow = 9, ncol = 1000)
spec[1, ] <- seq(from = 1, to = 10, length = 1000)
trend <- sin(pi * (seq(from = 0, to = 4, length = 1000)))
x <- TLSWsim(trend = trend, spec = spec)
plot.ts(x)
#---- simulate with functional trend, and spec a list of functions-----
spec <- vector(mode = "list", length = 10)
spec[[1]] <- function(u) {
1 + 9 * u
}
trend <- function(u) {
sin(pi * u)
}
x <- TLSWsim(trend = trend, spec = spec)
plot.ts(x)
Run the code above in your browser using DataLab