rm(list=ls()) N0 <- 200 mu <- 0.001672504 sigma <- 0.236635 N <- array(0,c(100,25)) N[,1] <- rep(N0,100) for (i in 1:100){ for (j in 1:24){ N[i,j+1] <-exp(rnorm(1,mu,sigma))*N[i,j] } } t <- seq(1,25,1) plot(t,N[1,], type="n", ylim=c(0,2000),ylab="N") for (k in 1:100){ lines(t,N[k,], col=runif(1,1,10)) } ####################################### lag <- 100 x <- array(0,c(1,lag)) r = 1.2 x[1] <- 0.1 ##### for (i in 2:lag) { x[i] <- r*x[i-1]*(1-x[i-1]) } par( mfrow=c(2,1)) t <- seq(1,lag,1) plot(t,x, type="n",ylab="N") lines(t,x) a <- x[1:(length(x)-1)] b <- x[2:length(x)] plot(a,b, type="n",xlab="N", ylab="Nt+1") points(a,b,pch=16) par( mfrow=c(1,1)) x[99] ################################# K <- 100 ri <- 5 theta <- c(3,1,.3) xi <- seq(1,100,1) Xi <- array(0,c(100,3)) for (i in 1:3){ Xi[,i] <- xi*exp(ri*(1-(xi/K)^theta[i]))} plot(xi,log(Xi[,1]/xi), type ="n",xlab="Nt",ylab="log(Nt/Nt+1)") lines(xi,log(Xi[,1]/xi),col="red") lines(xi,log(Xi[,2]/xi),col="blue") lines(xi,log(Xi[,3]/xi),col="yellow") ################################# rr <- seq(2.9,4,0.01) ini <- seq(0.3,1,0.01) m <- array(0,c(length(ini),length(rr))) for (j in 1:length(rr)) { for (k in 1:(length(ini-1))) { x[1] <- ini[k] for (i in 2:300) { x[i] <- rr[j]*x[i-1]*(1-x[i-1]) } m[k,j]<- x[299] } } plot(rr,m[length(ini),], type ="n",ylim=c(0,1)) for (i in 1:(length(ini)-1)){ points(rr,m[i,1:length(rr)],pch=16, cex=0.00001) }