I have tried writing this code a couple of ways and keep producing the same error: "Plot: Vectors must be the same lengths." I am relatively new to Matlab.
Pop0 = [0.2 0.42 1.0 1.4 5 6 7 8] format shortg for i = 1:length(Pop0) A = [0 0 Pop0(i); .6 0 0; 0 .75 .95] [v,lambda] = eig(A) lambdavector = max(lambda); for b1 = 1:length(lambdavector) if max(max(abs(lambda))) == abs(lambdavector(b1)) loc = b1; deig = lambda(b1,b1); end end normv(:,i) = v(:,loc)/sum(v(:,loc)); end a1 = normv(1,:); b1 = normv(2,:); c1 = normv(3,:); plot(Pop0,a1, 'r', Pop0,b1, 'g', Pop0,c1, 'b') xlabel('Adult Fecundity') ylabel('Equilibrium Structure')
Best Answer