Optimization with fmincon: Error==> initVals.f = feval(funfcn{3},X,varargin{:});
1 次查看(过去 30 天)
显示 更早的评论
Hi I'm trying to execute an optimization program but i keep getting this error:
"
Error in ==> fmincon at 540
initVals.f = feval(funfcn{3},X,varargin{:}); "
I do not understand what does it mean. Is someone ready to help me?
My program is:
function [Apv, Awt, Ah] = minimum_cost
hybrid_simulator_multi
design0 = [10 10 200];
ndcdc=0.95;
nacdc=0.95;
ndis=1;
nch=0.85;
ninv=0.95;
nwr=0.98;
load data_2010_45_175;
Vwind=data_2010(:,2);
Ir=data_2010(:,1);
Ta=data_2010(:,3);
Pload=data_2010(:,4);
yout=[];
designold=[];
opt = simset('SrcWorkspace','Current');
[tout,xout,yout] = sim('hybrid_simulator_multi',[],opt);
options = optimset('fmincon');
options=optimset(options,'Display','iter','TolX',0.001,'TolFun',0.001);
options=optimset(options,'Algorithm','sqp');
design = fmincon(@trackmmobj,design0,[],[],[],[],[6 6 150],[15 12 300],@trackmmcon,options);
Apv = design(1); Awt = design(2); Ah = design(3);
function F = trackmmobj(design)
F(1) = yout(1,1);
end
function [c,ceq] = trackmmcon(design)
c =yout(end,3)-5;
ceq=[];
end
end
Thank you for your help!
0 个评论
回答(1 个)
Alan Weiss
2013-11-11
I do not understand how you are trying to optimize your simulation. Your objective function file, if I understand correctly, is:
function F = trackmmobj(design)
F(1) = yout(1,1);
end
How is this function supposed to take a value of design and evaluate it? I have the same question about your nonlinear constraint function.
Alan Weiss
MATLAB mathematical toolbox documentation
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Nonlinear Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!