Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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

1 vue (au cours des 30 derniers jours)
crazysheep
crazysheep le 31 Mar 2016
Clôturé : MATLAB Answer Bot le 20 Août 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 commentaire
jgg
jgg le 31 Mar 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.

Réponses (1)

Dave Behera
Dave Behera le 4 Avr 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