I try to minimize a function
1 view (last 30 days)
Show older comments
the function is: function f=obj(x) f=1-x(1)-x(2);
here are the constrained function [c, ceq]=confun(x) c=[x(1)-1; x(2)-1; -x(1); -x(2)]; ceq=0.2^2*x(1)^2+0.1^2*x(2)^2+2*0.1*0.2*0.5*x(1)*x(2)-0.15^2;
but when I run the following program it doesn't not work
x0=[0;0.25]; options = optimoptions(@fmincon); [x,fval] = ... fmincon(@objfun,x0,[],[],[],[],[],[],@confun,options)
1 Comment
John D'Errico
on 19 May 2015
Edited: John D'Errico
on 19 May 2015
Don't just say it does not work. WHAT DOES IT DO? Why do you think it does not work? It MIGHT be something as simple as the possibility that you named your function obj, but then you pass in @objfun into fmincon. Is it possible that the two are not the same thing?
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!