Info
此问题已关闭。 请重新打开它进行编辑或回答。
Getting error -- Not enough input argument while run the code below
1 次查看(过去 30 天)
显示 更早的评论
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
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
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.
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!