我目前正在进行涉及R中的Lokta Volterra模型的研究,其中包含当前代码:
lotVmod<- function (Time, State, Pars){
with(as.list(c(State, Pars)),{
dx= x*(alpha - beta*y)
dy= y*(gamma - delta*x)
return(list(c(dx,dy)))
})
}
Pars<- c(alpha = 1, beta= 1.1, gamma = 0.5, delta = 1)
State <- c(x = 0 , y = 0)
Time <- seq(0, 100, by =1)
out<- as.data.frame(ode(func= lotVmod, y= State, parms=Pars, times=Time))
matplot(out[,-1], type = "l", xlab = "Time", ylab = "Population")
legend("topleft", c("Aphids", "Parasitoid"), lty = c(1,2), col = c(1,2), box.lwd = 0)
我想评估不同州比率对模型输出的影响。要做到这一点,我想我需要在x和y插入for循环?然而到目前为止,尽管阅读了多个答案和指南,但我还是没有运气。任何帮助将不胜感激。