Index error with no array?
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
darkphotonix
le 6 Mai 2019
Commenté : darkphotonix
le 6 Mai 2019
Good afternoon,
I am getting a Index exceeds the number of array elements (1). line 29 which is my fun variable. I am not creating any arrays nor do I have more than one value for a given variable, what is wrong with my code?
L = 7/1000; %1mm/1000mm = 1m
rho = 2800; %kg/m^3
c = 900; %J/kg*K
k = 180; %W/m*K
eff = 0.80;
T_inf = 25 + 273.15; % K
T_surf = T_inf;
As = 0.040;% m^2
q_dp_h = 1.25 * 10^4; %W/m^2*K uniform heat flux
h = 10; %W/m^2*K
T = 135 + 273.15; % K
V = As * L ;
SB = 5.67 * 10^(-8); % W/m^2*K Stephan-Boltzmann
fun = (q_dp_h-(h(T-T_inf))-(eff*SB*((T^4)-(T_surf^4))));
fun2 = ((T-T_inf)*(rho*V*c))/As;
h_r = eff*SB*(T+T_surf)*((T^2)+(T_surf^2));
Bi = (h*L)/k;
Bi_r = (h_r*L)/k;
Bi_tot = Bi+Bi_r;
t=fun2/fun;
0 commentaires
Réponse acceptée
Walter Roberson
le 6 Mai 2019
h(T-T_inf) is a request to index h at location T-T_inf, which just happens to be the integer 110.
Remember that MATLAB does not have any implicit multiplication. All multiplication must be given explicitly using the .* or * operators.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!