fmincon(@HourlyCost,x0,[],[],[],[],lb,[],[],options) says that HourlyCost is to be the objective function. Objective functions are always passed the current x value (the parameter whose value is to produce the minimum result). But your HourlyCost function is defined to take no arguments.
Your objective function is not required to use the parameter that is passed in, but it is required to accept a parameter.
function Cost_h=HourlyCost(X)
I have to ask, though, why you are asking to minimize something whose value is fixed? If your HourlyCost is always going to return the same result for all arguments then there isn't anything to minimize.
Best Answer