Index exceeds the number of array elements (2).
Afficher commentaires plus anciens
New to mat lab something wrong with line 9. I just corrected the D(n) still don't know whats going wrong.
clear all
temp = [850:0.1:950];
time = [0:004:4];
for n= 1:1000
D(n)=(2.3.*10^(-5)).*exp((-148000)./(8.314.*((temp(n))+273.15)));
end
for x = 1:1:1000
for k = 1:1:1000
InsideErf(k) = 0.002./((D(x)./(time(k)) ;
end
end
Réponses (1)
Walter Roberson
le 5 Déc 2021
D=(2.3.*10^(-5)).*exp((-148000)./(8.314.*((temp)+273.15)));
That overwrites all of D in every iteration of the n loop. You should be assigning to D(n) instead of to D alone.
2 commentaires
Thomas McKenney
le 5 Déc 2021
Modifié(e) : Walter Roberson
le 5 Déc 2021
Walter Roberson
le 5 Déc 2021
clear all
temp = [850:0.1:950];
time = [0:004:4];
for n= 1:1000
D(n)=(2.3.*10^(-5)).*exp((-148000)./(8.314.*((temp(n))+273.15)));
end
for x = 1:1:1000
for k = 1:1:1000
InsideErf(k) = 0.002./((D(x)./(time(k)) ;
% 1 0 12 3 2 3 4 32
end
end
The digits indicate the number of open bracket levels "after" executing the character directly above. So at the end of the line, there are still two ( that do not have a matching )
Catégories
En savoir plus sur Matrix Indexing dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!