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 HourlyCostToo 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.
Best Answer