Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Getting error -- Not enough input argument while run the code below

1 visualización (últimos 30 días)
crazysheep
crazysheep el 31 de Mzo. de 2016
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
function [res1, res2, res3] = func_Rt(t, R_s, R_t, W_t, Y_g, D_t, rho_E, rho_R, fuelEff)
if mod(t, 2)==0
if R_t + rho_R*(W_t + fuelEff*Y_g - D_t) >= R_s
res1 = R_s;
res2 = 0;
res3 = 0.1*(R_t + rho_R*(W_t + fuelEff*Y_g - D_t) - R_s);
else
if (D_t < W_t + fuelEff*Y_g) && (R_t + rho_R*(W_t + fuelEff*Y_g - D_t) < R_s)
res1 = R_t + rho_R*(W_t + fuelEff*Y_g - D_t);
res2 = 0;
res3 = 0;
elseif D_t > W_t + fuelEff*Y_g
res1 = R_t;
res2 = D_t - W_t - fuelEff*Y_g;
res3 = 0;
end
end
end
if mod(t, 2) ==1
if (D_t < W_t + fuelEff*Y_g) && R_t == R_s
res1 = R_t;
res2 = 0;
res3 = 0.1*(W_t + fuelEff*Y_g - D_t);
else
if D_t > W_t + fuelEff*Y_g + rho_E*R_t
res1 = 0;
res2 =(D_t - (W_t + fuelEff*Y_g + rho_E*R_t));
res3 = 0;
elseif (D_t < rho_E*R_t + W_t + fuelEff*Y_g) && (W_t + fuelEff*Y_g < D_t)
res1 = R_t - (D_t - W_t - fuelEff*Y_g)/rho_E;
res2 = 0;
res3 =0;
end
end
end
end
  1 comentario
jgg
jgg el 31 de Mzo. de 2016
How are you calling this function? From the tags you posted it looks like you didn't assign the outputs or inputs properly. We'd need to see that first to tell what's going on.

Respuestas (1)

Dave Behera
Dave Behera el 4 de Abr. de 2016
There are no function calls inside this function. Therefore, it seems that you are not passing enough arguments to the function. Can you confirm that?
Also, the output arguments may end up being undefined under certain conditions which your code does not handle yet. That can also throw an error in the future.

Community Treasure Hunt

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

Start Hunting!

Translated by