matlab中fmincon求解问题?
我在用MATLAB求解螺栓优化问题,但是不知道谁很忙原因老是求解不成功。
以下是我的程序:
(非线性约束.m文件)
function [c,ceq] = mynas(x)
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
ceq=[];
c=[47947545/(x(1)*x(2)^2)-106;
400*pi/x(1)-10*x(2);
-400*pi/x(1)+5*x(2)];
end
(求解程序)
option=optimset('Algorithm','interior-point','TolX',6e-11,'TolCon',2e-8);
f=@(x)x(1)*x(2);
x0=[60,60];
A=[-1,0;0,-1];
b=[0;0];
[x,fval]=fmincon(f,x0,A,b,[],[],[],[],@mynas,option)
以下是求解后的提示:
Local minimum possible. Constraints satisfied.
fmincon stopped because the size of the current step is less than
the selected value of the step size tolerance and constraints are
satisfied to within the selected value of the constraint tolerance.
<stopping criteria details>
x =
1.0e+17 *
8.5560 0.0000
fval =
6.2211e+11