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

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

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일

0 개 추천

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.

이 질문은 마감되었습니다.

질문:

2016년 3월 31일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by