MATLAB: Index in position 1 is invalid. Array indices must be positive integers or logical values.

arrayindex

I'm not sure why I keep getting this error when I want to run my code:
q=[0.00000000094920 0.0000000092698 0.000000089470 0.00000084780 0.0000077991 0.000068296 0.00054952 0.0038119 0.020569 0.077098 0.19427 0.35465 0.51978 0.66174 0.77065];
eta=0.2;
a=0.115;
b=0.176;
v=0:10000000;
for j=1:length(q)
for k=1:length(v)
exactbdw(j,k)=((q(j).^(v(k).^eta))-(q(j).^((v(k)+1).^eta))).*(1-(beta(a,(b+v(k)))/beta(a,b)));
end
end
And the error I get is:
Index in position 1 is invalid. Array indices must be positive integers or logical values.

Best Answer

You're getting the error because you are using 'beta(a,b)' inside your loop, but neither a or b are positive integers or logic statements.
Related Question