# Generate seasonal data with period = 2
t <- seq(0, 20, length.out = 400)
X <- matrix(sin(2 * pi * t / 2) + 0.1 * rnorm(400), nrow = 1)
fd <- fdata(X, argvals = t)
# Detect period using SAZED
result <- sazed(fd)
print(result) # Shows consensus period and component details
# With trend - SAZED's spectral_diff component handles this
X_trend <- matrix(0.3 * t + sin(2 * pi * t / 2), nrow = 1)
fd_trend <- fdata(X_trend, argvals = t)
result <- sazed(fd_trend)
Run the code above in your browser using DataLab