So my code will run just fine when I first boot up MatLab. But if I try to run it again, I always get this message "Error using plot Vectors must be the same lengths." Is this a computer memory issue on my end or something?
MatLab Version: 8.1.0.604 (R2013a)
t=[0 .3 .5 .75 .95 .99];for i = 1:length(t) A = [0.0 0.0 .42;.6 0.0 0.0;0.0 0.75 t(i)]; [v,lambda] = eig(A); lambdavector = max(lambda); for y = 1:length(lambdavector) if max(max(abs(lambda))) == abs(lambdavector(y)) loc = y; deig = lambda(y,y); end end normv(:,i) = v(:,loc)/sum(v(:,loc)); endc = normv(1,:);y = normv(2,:);a = normv(3,:);figureplot(t,c,'b.-',t,y,'g.-',t,a,'r.-')xlabel('Adult Survival Rate')ylabel('Equilibrium Population')title('Adult Survival Changed')legend('Calves','Yearlings','Adults')
Best Answer