Index error with no array?

8 vues (au cours des 30 derniers jours)
darkphotonix
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;

Réponse acceptée

Walter Roberson
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.
  1 commentaire
darkphotonix
darkphotonix le 6 Mai 2019
Great! Did not see that mistake!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing 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