fmincon error message 'Too many input arguments'
이전 댓글 표시
I have checked file names (no matching file names), plus all function return a scalar value;yet I still get the following error message:
Error using HourlyCost
Too many input arguments.
Error in fmincon (line 564)
initVals.f = feval(funfcn{3},X,varargin{:});
Error in CostOpt (line 5)
MinCost=fmincon(@HourlyCost,x0,[],[],[],[],lb,[],[],options);
Caused by:
Failure in initial user-supplied objective function evaluation. FMINCON cannot continue.
%Objective function
function Cost_h=HourlyCost()
a=0.3;
b=1;
c=2;
L_h=TtlEngh();
Cost_h=a*L_h^2+b*L_h+c*L_h;
end
%Optimizing the Objective function
function MinCost=CostOpt()
x0=0;
lb=0;
options=optimset('Algorithm','interior-point');
MinCost=fmincon(@HourlyCost,x0,[],[],[],[],lb,[],[],options);
end
Please, help.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Choose a Solver에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!