- Did the code throw an error? If so what is the full and exact text of the error message (all the text displayed in red)? If you also received warning messages show all the warning text displayed in orange as well.
- Did the code give you a different answer than you expected? If so show the answer you received and the answer you expected and explain why you believe the answer you expected is the correct answer.
- Did MATLAB crash? If so please find the crash log file and send it to Technical Support for investigation.
- Did something else unexpected happen? If so, what happened?
Why option for fmincon is not working ?
5 次查看(过去 30 天)
显示 更早的评论
I defined the option as follows and it is not working. I tried many other options as well. Could anyone gives some idea ? Thanks
options = optimoptions('fmincon','Algorithm','interior-point','Display','iter-detailed',...
'MaxFunctionEvaluation',100000,'MaxIterations',2000,'FunctionTolerance',1e-10);
A=[]; b =[]; Aeq =[]; beq =[]; %x is vector
[V,fval,exitflag,output,lambda,grad,hessian] = fmincon(fun,x,A,b,Aeq,beq,LB,UB,options)
2 个评论
Steven Lord
2020-11-6
What does "not working" mean?
采纳的回答
更多回答(1 个)
Steven Lord
2020-11-6
If you want to provide an options structure to fmincon you must provide all the input arguments that precede it. While you've passed in fun, x, A, b, Aeq, beq (these four as empty matrices), LB, and UB you haven't passed in nonlcon which is the nonlinear constraint function. The documentation page for fmincon provides this advice: "If there are no nonlinear inequality or equality constraints, set nonlcon = []."
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!