A <- matrix(c(0, 0.5, 20, 0.3, 0, 0, 0, 0.5, 0.9), nr = 3, byrow = TRUE)
A
##      [,1] [,2] [,3]
## [1,]  0.0  0.5 20.0
## [2,]  0.3  0.0  0.0
## [3,]  0.0  0.5  0.9
nt <- matrix(c(100, 250, 50), ncol = 1)
nt
##      [,1]
## [1,]  100
## [2,]  250
## [3,]   50
nt1= A %*% nt
nt1
##      [,1]
## [1,] 1125
## [2,]   30
## [3,]  170
years=6
n.projections <- matrix(0, nrow = nrow(A), ncol = years + 1)
n.projections
##      [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## [1,]    0    0    0    0    0    0    0
## [2,]    0    0    0    0    0    0    0
## [3,]    0    0    0    0    0    0    0
n.projections[, 1] <- nt
n.projections
##      [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## [1,]  100    0    0    0    0    0    0
## [2,]  250    0    0    0    0    0    0
## [3,]   50    0    0    0    0    0    0
for (i in 1:years) n.projections[, i + 1] <- A %*% n.projections[,i]
n.projections
##      [,1] [,2]   [,3]    [,4]     [,5]      [,6]      [,7]
## [1,]  100 1125 3415.0 3528.75 6911.250 16533.412 26026.628
## [2,]  250   30  337.5 1024.50 1058.625  2073.375  4960.024
## [3,]   50  170  168.0  319.95  800.205  1249.497  2161.235
matplot(0:years, t(n.projections), type = "l", lty = 1:3,col = 1, ylab = "Stage Abundance", xlab = "Year")
legend("topleft", legend = c("Seeds", "Small Adult", "Large Adult"),lty = 1:3, col = 1, bty = "n")