matlab求解器不收敛,fmincon求解,不收敛,请问下是怎么回
事?
本帖最后由 殇逝 于 2016-3-31 10:20 编辑
fmincon求解,不收敛,取不到最优解,请问下是怎么回事?程序如下:
function f=steering_myfun(x)
global K L M %L轴距 K轮距
f=0;
for i=1:30
Z=0.5*acot(cot(i)-K/L)+0.5*i;
A=(K-M)/2;
B=sqrt((A-x(1)*cos(x(3)))^2+(x(1)*sin(x(3))-x(2))^2);
S=x(1)*cos(x(3)-i)+sqrt(B^2-(x(1)*sin(x(3)-i)-x(2))^2)-A;
C=atan(x(2)/(A-S));
D=acos((x(1)^2+x(2)^2+(A-S)^2-B^2)/(2*x(1)*sqrt(x(2)^2+(A-S)^2)));
N=C+D-x(3);
if i>0&&i<=10;
omg=1.5;
elseif i>10&&i<=20;
omg=1.0;
else
omg=0.5;
end
W=omg*abs(N./Z-1);
f=f+W;
end
end
function[c,ceq]= steering_mycon(x)
global K M
fmin=20.5;fmax=27;smax=30;th=40;
A=(K-M)/2;
function怎么记忆
B=sqrt((A-x(1)*cos(x(3)))^2+(x(1)*sin(x(3))-x(2))^2);
c(1)=-x(1)*cos(x(3));
c(2)=((x(1)^2+B.^2-(((K-M)/2)^2+x(3)^2))/(2*x(1)*B))-cos(smax);
c(3)=x(1)*cos(x(3)-fmax)-sqrt(B^2-(x(1)*sin(x(3)-fmax))^2)-(K-M)/2-th;
c(4)=abs(x(1)*sin(x(3)+fmin)-x(2))-B*sin(10);
c(5)= abs(x(1)*sin(x(3)-fmax)-x(2))-B*sin(10);
ceq=[];
function steering_main
global K L M%L轴距 K轮距
K=1140;
L=1600;
M=414;
clc;
x0=[66;40;105];
lb=[45;30;90];
ub=[85;70;120];
options=optimset('LargeScale','off','TolFun',1e-10);
[x,fval,exitflag,output]=fmincon(@steering_myfun,x0,[],[],[],[],lb,ub,@steering_mycon,options)  %⽬标函数求解结果:
No feasible solution found.
fmincon stopped because the size of the current step is less than
the default value of the step size tolerance but constraints are not
satisfied to within the default value of the constraint tolerance.

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。