Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
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.

Réponse acceptée

Bob Thompson
Bob Thompson le 11 Fév 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 commentaires
Bob Thompson
Bob Thompson le 12 Fév 2019
Modifié(e) : Bob Thompson le 12 Fév 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)));

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Special Functions dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by