Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #---- Huffaker 2 naranjas
- # fig_12
- # variables
- N1 <- numeric() # naranja 1
- P1 <- numeric()
- N2 <- numeric() # naranja 2
- P2 <- numeric()
- # coeficientes
- lambda <- 1.4 # tasa crecimiento
- c <- 3 # huevos parásito
- a <- 0.01 # eficacia parásito
- m <- 0.05 # fracción emigrante
- # condiciones simulación
- ngen <- 2000 # generaciones
- N1[1] <- 30 # N inicial
- N2[1] <- 0
- P1[1] <- 50 # P inicial
- P2[1] <- 0
- # simulación
- for (t in 1:ngen) {
- # en la naranja 1
- f1 <- exp(-a * P1[t])
- N1[t + 1] <- lambda * N1[t] * f1 * (1 - m) + m*N2[t]
- P1[t + 1] <- lambda * c * N1[t] * (1 - f1) * (1 - m) - m*(P1[t] - P2[t])
- # en la naranja 2
- f2 <- exp(-a * P2[t])
- N2[t + 1] <- lambda * N2[t] * f2 * (1 - m) + m*N1[t]
- P2[t + 1] <- lambda * c * N2[t] * (1 - f2) * (1 - m) - m*(P2[t] - P1[t])
- }
- # gráfico (dos en la misma figura)
- pdf("fig_12.pdf", width = 7, height = 6)
- par(pty = "s",
- bty = "n",
- mar = c(5, 2, 1, 1),
- xaxs = "i",
- yaxs = "i",
- las = 1)
- plot(N1, P1,
- type = "b",
- lty = 1,
- cex = 0.8,
- pch = 16,
- col = "royalblue",
- xlim = c(0, 120),
- ylim = c(0, 300),
- xlab = "N",
- ylab = "P")
- lines(N2, P2,
- type = "b",
- lty = 2,
- cex = 0.8,
- pch = 21,
- col = "coral")
- legend("topright",
- c("naranja 1", "naranja 2"),
- lty = c(1, 2),
- cex = 1,
- pch = c(16, 21),
- col = c("royalblue", "coral"),
- bty = "n")
- dev.off()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement