Why am I receive Fmincon error ?

2 次查看(过去 30 天)
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

采纳的回答

Matt J
Matt J 2023-2-7
x0 = ones(3,21);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Nonlinear Optimization 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by