| seasonal | R Documentation |
Create a seasonal wave function that oscillates between -1 and 1, with a specified period and shift. The wave peaks at the specified shift time.
seasonal(times, period = 1, shift = 0)
times |
Vector of simulation times |
period |
Duration of wave in simulation time units. Defaults to 1. |
shift |
Timing of wave peak in simulation time units. Defaults to 0. |
Equivalent of Seasonal() in Insight Maker
Seasonal interpolation function
step(), pulse(), ramp()
# Create a simple model with a seasonal wave
sfm <- xmile() |>
build("a", "stock") |>
# Specify the global variable "times" as simulation times
build("input", "constant", eqn = "seasonal(times, 10, 0)") |>
build("inflow", "flow", eqn = "input(t)", to = "a")
sim <- simulate(sfm, only_stocks = FALSE)
plot(sim)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.