问题
How do I use ggplot to plot the predator species against the prey species?
These are the equations I'm using;
dX/dt = a1X - b1XY, X(0) = X0 #Prey
dY/dt = a2XY - b2Y, Y(0) = Y0 #Predator
These are the values of my constants;
a1 = 1.247
b1 = .384
a2 = .123
b2 = .699
X0 = 5.415
Y0 = 6.923
K = 9.438
This piece of code below describes the right hand side of the equations, however I'm unsure if this is relevant to plotting the two species.
ydot.lv <- function(t,y,parms){
ydot <- rep(NA,2)
ydot[1] <- parms[1]*y[1] - parms[2]*y[1]*y[2]
ydot[2] <- parms[3]*y[1]*y[2] - parms[4]*y[2]
return(list(ydot))
}
来源:https://stackoverflow.com/questions/43861974/lotka-volterra-equations-using-r