Index in position 1 is invalid. Array indices must be positive integers or logical values.
1 view (last 30 days)
Show older comments
Mary Jacketti
on 11 Feb 2019
Commented: madhan ravi
on 12 Feb 2019
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.
0 Comments
Accepted Answer
Bob Thompson
on 11 Feb 2019
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.
3 Comments
Bob Thompson
on 12 Feb 2019
Edited: Bob Thompson
on 12 Feb 2019
Is beta a function? Not a matrix?
If that is the case I would suggest solving the beta function first, then inputting the results into the equation.
for j=1:length(q)
for k=1:length(v)
bet(1) = beta(a,(b+v(k)));
bet(2) = beta(a,b);
exactbdw(j,k)=((q(j).^(v(k).^eta))-(q(j).^((v(k)+1).^eta))).*(1-(bet(1)/bet(2)));
More Answers (0)
See Also
Categories
Find more on Special Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!