Clear Filters
Clear Filters

Why am I receive Fmincon error ?

2 views (last 30 days)
Oskar S.
Oskar S. on 7 Feb 2023
Commented: Oskar S. on 7 Feb 2023
I'm getting Fmincon warning every time and how can I fix it ?
demand = [600,900,900,700,800,500,500];
power_from_plant1 = 30; %MW
power_from_plant2 = 50; %MW
cost_plant1 = 150; %kr/MWh
cost_plant2 = 600; %kr/MWh
Tankloss = 0.02; %
A = [];
b = [];
Aeq = [];
beq = [];
LB = [zeros(3,7), zeros(3,7), zeros(3,7)];
UB = [24*ones(3,7), 24*ones(3,7), 300*ones(3,7)];
x0 = ones(3,7);
[xopt,fopt]=fmincon(@fun,x0,A,b,Aeq,beq,LB,UB,@non1con);
Warning: Length of lower bounds is > length(x); ignoring extra bounds.
Warning: Length of upper bounds is > length(x); ignoring extra bounds.
Unrecognized function or variable 'fun'.

Error in fmincon (line 568)
initVals.f = feval(funfcn{3},X,varargin{:});
------> this part

Accepted Answer

Matt J
Matt J on 7 Feb 2023
x0 = ones(3,21);

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!