Index error with no array?

8 Ansichten (letzte 30 Tage)
darkphotonix
darkphotonix am 6 Mai 2019
Kommentiert: darkphotonix am 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;

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 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 Kommentar
darkphotonix
darkphotonix am 6 Mai 2019
Great! Did not see that mistake!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by