Array input functions..index exceeds the number of array elements (1).

1 visualización (últimos 30 días)
Can anyone help me in debugging this code?
You can give the values ,what ever you want.....the issue i am facing is Index exceeds the number of array elements (1).
I know what this error means,but dont know how to debugg .
sigma_juice=0.02;
T_sat=105;
row_juice=1060.6;
row_v=0.00485;
hfg_w=101325;
A=0.025;
g=9.81;
total_mev=535.5;
T=10;
inputTArray = [];
hfg_j = [];
row_l= [];
mu_l= [];
K_l=[];
C_pl=[];
P_rl=[];
x=[];
R=[];
y=[];
xy=[];
total_weight=[];
m_dot_ev=[];
sum_xy = 0;
sum_xx=0;
sum_y=0;
sum_x=0;
sum_h=0;
N=5;
c=[];
m_ev=[];
T=[];
for i = 1:N
m_ev = input('Enter m_ev value : ');
total_weight = input('Enter total_weight value : ');
T = input('Enter T value : ');
T_s = input('Enter T_s value : ');
inputTArray(i) = T
inputT_sArray(i) = T_s
inputtotal_weightArray(i) = total_weight
inputm_evArray(i) = m_ev
C(i)=((total_weight(i)-(total_mev-m_ev(i)))/(total_mev-m_ev(i)));
m_dot_ev(i)=m_ev(i)/T
hfg_j(i) = hfg_w*0.75;
row_l(i) = 1043+(4.854*C)-(1.07*T)
mu_l(i) = exp(-11.29+(3257.5/T)+(0.07572*C));
K_l(i) = 0.3815-(0.0051*C)+(0.001866*T)
C_pl(i) = 2.38-(.006*T)
P_rl(i) = (mu_l(i) * C_pl(i))/K_l(i)
x(i)=log(P_rl(i))
R(i)=((C_pl(i)*(T_s(i)-T_sat))/hfg_j(i))*(((A*mu_l(i))/m_dot_ev(i).^(1/3))*(((g*(row_l(i)-row_v))/sigma_juice).^(1/6)))
y(i)=log(R(i))
xy(i) = x(i).*y(i)
sum_xy = sum_xy + xy(i);
xx(i)=x(i).*x(i);
sum_xx=sum_xx+xx(i);
sum_x=sum_x+x(i);
sum_y=sum_y+y(i);
m=(N*(sum_xy-(sum_x*sum_y)))/(N*sum_xx-(sum_x*sum_x));
c=((sum_xx*sum_y)-(sum_x*sum_xy))/((N*sum_xx)-(sum_x*sum_x));
n=m
c_sf=10.^(c)
q_nucleate(i)=(mu_l(i)*hfg_j(i))*(((g*(row_l(i)-row_v))/sigma_juice).^(1/2))*((C_pl(i)*(T_s(i)-T_sat))/(c_sf*hfg_j(i)*(P_rl(i).^(n)))).^(3);
h(i)=(q_nucleate(i)/(T_s(i)-T_sat));
sum_h=sum_h+h(i);
P=sum_h/18
end
  2 comentarios
Rik
Rik el 30 de Ag. de 2020
Original question retrieved from Google cache (archived page of this cache here):
Array input functions..index exceeds the number of array elements (1).
Can anyone help me in debugging this code?
You can give the values ,what ever you want.....the issue i am facing is Index exceeds the number of array elements (1).
I know what this error means,but dont know how to debugg .
sigma_juice=0.02;
T_sat=105;
row_juice=1060.6;
row_v=0.00485;
hfg_w=101325;
A=0.025;
g=9.81;
total_mev=535.5;
T=10;
inputTArray = [];
hfg_j = [];
row_l= [];
mu_l= [];
K_l=[];
C_pl=[];
P_rl=[];
x=[];
R=[];
y=[];
xy=[];
total_weight=[];
m_dot_ev=[];
sum_xy = 0;
sum_xx=0;
sum_y=0;
sum_x=0;
sum_h=0;
N=5;
c=[];
m_ev=[];
T=[];
for i = 1:N
m_ev = input('Enter m_ev value : ');
total_weight = input('Enter total_weight value : ');
T = input('Enter T value : ');
T_s = input('Enter T_s value : ');
inputTArray(i) = T
inputT_sArray(i) = T_s
inputtotal_weightArray(i) = total_weight
inputm_evArray(i) = m_ev
C(i)=((total_weight(i)-(total_mev-m_ev(i)))/(total_mev-m_ev(i)));
m_dot_ev(i)=m_ev(i)/T
hfg_j(i) = hfg_w*0.75;
row_l(i) = 1043+(4.854*C)-(1.07*T)
mu_l(i) = exp(-11.29+(3257.5/T)+(0.07572*C));
K_l(i) = 0.3815-(0.0051*C)+(0.001866*T)
C_pl(i) = 2.38-(.006*T)
P_rl(i) = (mu_l(i) * C_pl(i))/K_l(i)
x(i)=log(P_rl(i))
R(i)=((C_pl(i)*(T_s(i)-T_sat))/hfg_j(i))*(((A*mu_l(i))/m_dot_ev(i).^(1/3))*(((g*(row_l(i)-row_v))/sigma_juice).^(1/6)))
y(i)=log(R(i))
xy(i) = x(i).*y(i)
sum_xy = sum_xy + xy(i);
xx(i)=x(i).*x(i);
sum_xx=sum_xx+xx(i);
sum_x=sum_x+x(i);
sum_y=sum_y+y(i);
m=(N*(sum_xy-(sum_x*sum_y)))/(N*sum_xx-(sum_x*sum_x));
c=((sum_xx*sum_y)-(sum_x*sum_xy))/((N*sum_xx)-(sum_x*sum_x));
n=m
c_sf=10.^(c)
q_nucleate(i)=(mu_l(i)*hfg_j(i))*(((g*(row_l(i)-row_v))/sigma_juice).^(1/2))*((C_pl(i)*(T_s(i)-T_sat))/(c_sf*hfg_j(i)*(P_rl(i).^(n)))).^(3);
h(i)=(q_nucleate(i)/(T_s(i)-T_sat));
sum_h=sum_h+h(i);
P=sum_h/18
end

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 30 de Ag. de 2020
sigma_juice=0.02;
T_sat=105;
row_juice=1060.6;
row_v=0.00485;
hfg_w=101325;
A=0.025;
g=9.81;
total_mev=535.5;
T=10;
inputTArray = [];
hfg_j = [];
row_l= [];
mu_l= [];
K_l=[];
C_pl=[];
P_rl=[];
x=[];
R=[];
y=[];
xy=[];
total_weight=[];
m_dot_ev=[];
sum_xy = 0;
sum_xx=0;
sum_y=0;
sum_x=0;
sum_h=0;
N=5;
c=[];
m_ev=[];
T=[];
for i = 1:N
m_ev = input('Enter m_ev value : ');
total_weight = input('Enter total_weight value : ');
T = input('Enter T value : ');
T_s = input('Enter T_s value : ');
inputTArray(i) = T
inputT_sArray(i) = T_s
inputtotal_weightArray(i) = total_weight
inputm_evArray(i) = m_ev
C(i)=((inputtotal_weightArray(i)-(total_mev-inputm_evArray(i)))/(total_mev-inputm_evArray(i)));
m_dot_ev(i)=inputm_evArray(i)/T
hfg_j(i) = hfg_w*0.75;
row_l(i) = 1043+(4.854*C(i))-(1.07*T)
mu_l(i) = exp(-11.29+(3257.5/T)+(0.07572*C(i)));
K_l(i) = 0.3815-(0.0051*C(i))+(0.001866*T)
C_pl(i) = 2.38-(.006*T)
P_rl(i) = (mu_l(i) * C_pl(i))/K_l(i)
x(i)=log(P_rl(i))
R(i)=((C_pl(i)*(inputT_sArray(i)-T_sat))/hfg_j(i))*(((A*mu_l(i))/m_dot_ev(i).^(1/3))*(((g*(row_l(i)-row_v))/sigma_juice).^(1/6)))
y(i)=log(R(i))
xy(i) = x(i).*y(i)
sum_xy = sum_xy + xy(i);
xx(i)=x(i).*x(i);
sum_xx=sum_xx+xx(i);
sum_x=sum_x+x(i);
sum_y=sum_y+y(i);
m=(N*(sum_xy-(sum_x*sum_y)))/(N*sum_xx-(sum_x*sum_x));
c=((sum_xx*sum_y)-(sum_x*sum_xy))/((N*sum_xx)-(sum_x*sum_x));
n=m
c_sf=10.^(c)
q_nucleate(i)=(mu_l(i)*hfg_j(i))*(((g*(row_l(i)-row_v))/sigma_juice).^(1/2))*((C_pl(i)*(inputT_sArray(i)-T_sat))/(c_sf*hfg_j(i)*(P_rl(i).^(n)))).^(3);
h(i)=(q_nucleate(i)/(inputT_sArray(i)-T_sat));
sum_h=sum_h+h(i);
P=sum_h/18
end
  2 comentarios
Yamini Dolly
Yamini Dolly el 30 de Ag. de 2020
Editada: Yamini Dolly el 30 de Ag. de 2020
Thank you very much walter.I really appreciate for the help you have done.
Rik
Rik el 30 de Ag. de 2020
You have quite some nerve Yamini. First you email me your entire question instead of a link to your question (which didn't exist at that time). Then you post it here and get an answer from Walter. You post a thank-you comment, but then proceed to remove the question content. Very rude.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by