-->A=[[0; .3],[1.6; .8]] // [Juveniles, Adults]' A = ! 0. 1.6 ! ! 0.3 0.8 ! -->x0=[15;10] // initial population x0 = ! 15. ! ! 10. ! -->x=x0;for i=1:8, i, x=A*x, pop=sum(x,'r'), ratio=x(1,1)/x(2,1), end i = 1. x = ! 16. ! ! 12.5 ! pop = 28.5 ratio = 1.28 i = 2. x = ! 20. ! ! 14.8 ! pop = 34.8 ratio = 1.3513514 i = 3. x = ! 23.68 ! ! 17.84 ! pop = 41.52 ratio = 1.3273543 i = 4. x = ! 28.544 ! ! 21.376 ! pop = 49.92 ratio = 1.3353293 i = 5. x = ! 34.2016 ! ! 25.664 ! pop = 59.8656 ratio = 1.3326683 i = 6. x = ! 41.0624 ! ! 30.79168 ! pop = 71.85408 ratio = 1.333555 i = 7. x = ! 49.266688 ! ! 36.952064 ! pop = 86.218752 ratio = 1.3332594 i = 8. x = ! 59.123302 ! ! 44.341658 ! pop = 103.46496 ratio = 1.333358 -->y=zeros(2,10) y = ! 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ! ! 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ! -->y(:,1)=x0 y = ! 15. 0. 0. 0. 0. 0. 0. 0. 0. 0. ! ! 10. 0. 0. 0. 0. 0. 0. 0. 0. 0. ! -->for i=2:10, y(:,i)=A*y(:,i-1); end -->y y = column 1 to 8 ! 15. 16. 20. 23.68 28.544 34.2016 41.0624 49.266688 ! ! 10. 12.5 14.8 17.84 21.376 25.664 30.79168 36.952064 ! column 9 to 10 ! 59.123302 70.946652 ! ! 44.341658 53.210317 ! -->plot(y(1,:),y(2,:),"d-"); -->// Change gears and watched an iterative approximation to largest eigenvalue -->A=[2 0; 0 4]; x0 = x0/norm(x0) x0 = ! 0.8320503 ! ! 0.5547002 ! -->y(:,1)=x0; -->for i=2:10, y(:,i)=A*y(:,i-1); y(:,i) = y(:,i)/norm(y(:,i)); end -->y y = column 1 to 6 ! 0.8320503 0.6 0.3511234 0.1842885 0.0933407 0.0468236 ! ! 0.5547002 0.8 0.9363292 0.9828722 0.9956342 0.9989032 ! column 7 to 10 ! 0.0234311 0.0117179 0.0058593 0.0029297 ! ! 0.9997255 0.9999313 0.9999828 0.9999957 ! -->// Note that we have rapidly found the second eigenvector [0, 1]^T -->clf();plot(y(1,:),y(2,:),"d-");