Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #---- Nicholson & Bailey
- # fig_03
- # variables
- N <- numeric()
- P <- numeric()
- # coeficientes
- lambda <- 1.5
- c <- 3
- a <- 0.1
- # condiciones simulación
- ngen <- 30 # generaciones
- N[1] <- 3 # N inicial
- P[1] <- 4 # P inicial
- # simulación
- for (t in 1:ngen) {
- f <- exp(-a * P[t])
- N[t + 1] <- lambda * N[t] * f
- P[t + 1] <- lambda * c * N[t] * (1 - f)
- }
- # equilibrio
- Peq <- log(lambda) / a
- Neq <- Peq / (c * (lambda - 1))
- # gráfico (dos en la misma figura)
- pdf("fig_03.pdf", width = 5, height = 9)
- colorN <- "olivedrab"
- colorP <- "coral"
- par(mfrow = c(2, 1),
- pty = "s",
- bty = "n",
- mar = c(5, 2, 1, 1),
- xaxs = "i",
- yaxs = "i",
- las = 1)
- plot(0:ngen, N,
- type = "b",
- col = colorN,
- cex = 0.7,
- pch = 16,
- ylim = c(0, 20),
- ylab = "N, P",
- xlab = "Generación")
- lines(0:ngen, P,
- type = "b",
- col = colorP,
- cex = 0.6,
- pch = 21)
- legend("topleft",
- bty = "n",
- c("hospedador (N)", "parásito (P)"),
- col = c(colorN, colorP),
- lty = 1,
- pch = c(19, 21),
- cex = 0.8,
- pt.bg = "white")
- plot(N, P,
- type = "b",
- lty = 2,
- cex = 0.8,
- pch = 16,
- col = "royalblue",
- xlim = c(0, 10),
- ylim = c(0, 20))
- abline(h = Peq,
- col = "orange",
- lwd = 0.5)
- abline(v = Neq,
- col = "orange",
- lwd = 0.5)
- dev.off()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement