rm(list=ls())
library("deSolve")
dydt <- function(time, vars, pars) {
with(as.list(c(vars, pars)),
list(mu * (1 - N/K) * N) # logistic growth
)
}
dynam <- lsoda(y=c(N=1e4), parms=c(mu=2, K=1e9), # integration
func=dydt, times=seq(0, 15, .1))
par(mfrow=c(1,2)) # plot of dynamics
plot(dynam[,"time"], dynam[,"N"], type="l",
xlab="Time", ylab="Cells / mL (linear)")
plot(dynam[,"time"], dynam[,"N"], type="l", log="y",
xlab="Time", ylab="Cells / mL (log scale)")
par(mfrow=c(1,1))