fmincon error message 'Too many input arguments'
Show older comments
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.
Accepted Answer
More Answers (0)
Categories
Find more on Choose a Solver in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!