Info

この質問は閉じられています。 編集または回答するには再度開いてください。

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

1 回表示 (過去 30 日間)
crazysheep
crazysheep 2016 年 3 月 31 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件のコメント
jgg
jgg 2016 年 3 月 31 日
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.

回答 (1 件)

Dave Behera
Dave Behera 2016 年 4 月 4 日
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