Index error with no array?

조회 수: 6 (최근 30일)
darkphotonix
darkphotonix 2019년 5월 6일
댓글: darkphotonix 2019년 5월 6일
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;

채택된 답변

Walter Roberson
Walter Roberson 2019년 5월 6일
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
darkphotonix
darkphotonix 2019년 5월 6일
Great! Did not see that mistake!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by