我有一个由R包" deSolve
"构建的常微分方程(ODE)系统。从ODE中,是否可以运行模型,以便变量“y2”在下面的示例中的时间= 5(而不是时间= 0)处开始?
library(deSolve)
test <- function(t, y, parms) {
dy1 <- -2 * y[2]
dy2 <- 1.25 * y[1]
list(c(dy1, dy2))
}
yini <- c(y1 = 1, y2 = 0)
times <- seq(from = 0, to = 20, by = 0.01)
out <- ode (times = times, y = yini, func = test, parms = NULL)
plot(out)