Adding extra plot features for ODE prey solution comparisons
This commit is contained in:
parent
21c4dfe69c
commit
7222500638
@ -268,10 +268,17 @@ plot.pred.prey(pp.rk4.sol, "RK4")
|
|||||||
|
|
||||||
|
|
||||||
# plot comparing Prey solutions to ode45
|
# plot comparing Prey solutions to ode45
|
||||||
plot(pp.sol$t, pp.sol$y[,1], type="l", col="blue")
|
plot(pp.sol$t, pp.sol$y[,1], type="l", col="green", lwd=3, ylim=c(20,120),
|
||||||
|
xlim=c(0,200), main="Comparing Prey solutions")
|
||||||
par(new=T)
|
par(new=T)
|
||||||
lines(pp.euler.sol$t,pp.euler.sol$y[,1], col="red")
|
lines(pp.euler.sol$t,pp.euler.sol$y[,1], col="red", lwd=2)
|
||||||
|
par(new=T)
|
||||||
|
lines(pp.rk4.sol$t,pp.rk4.sol$y[,1], col="blue", lty="dashed", lwd=2)
|
||||||
|
legend(x = "topleft",
|
||||||
|
legend = c("ODE45", "Euler", "RK4"),
|
||||||
|
lty = c(1, 1, 2),
|
||||||
|
col = c("green", "red", "blue"),
|
||||||
|
lwd = 2)
|
||||||
|
|
||||||
# c) Use k3=0.02
|
# c) Use k3=0.02
|
||||||
pp.params.c <- c(.01, .1, .02, .05)
|
pp.params.c <- c(.01, .1, .02, .05)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user