MATLAB: Does the attempt to plot keep resulting in a “Vectors must be the same lengths” error

eigenvalueseigenvectorsmodelingplot

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

Set a breakpoint at the plot line, and hover your cursor over Pop0, a1, b1, and c1. You'll see that they're not all the same length. If you don't know what I'm talking about, see this excellent link: http://blogs.mathworks.com/videos/2012/07/03/debugging-in-matlab/
That said, I copied and pasted your code and it ran fine - no error message whatsoever !