|
以下是我做的3个M文件
myfun2.m
function f=myfun2(x)
f=0.785398*(4.75*x(1)*x(2)^2*x(3)^2+85*x(1)*x(2)*x(3)^2-85*x(1)*x(3)^2+0.92*x(1)*x(6)^2-x(1)*x(5)^2+0.8*x(1)*x(2)*x(3)*x(6)-1.6*x(1)*x(3)*x(6)+x(4)*x(5)^2+x(4)*x(6)^2+28*x(5)^2+32*x(6)^2);
mycon2.m
function [c,ceq]=mycon2(x)
c(1)=0.9-x(1)/(x(2)*x(3));
c(2)=x(1)/(x(2)*x(3))-1.4;
c(3)=x(2)*x(3)-300;
c(4)=1486250/(x(2)*x(3)*x(1)^0.5)-550;
c(5)=(9064860*2.65*2.22)/(x(1)*x(2)*x(3)^2)-400;
c(6)=(((9064860*2.65*2.22)/(x(1)*x(2)*x(3)^2)-400)*1.59*1.81)/(2.65*2.22)-400;
c(7)=(117.04*x(4)^4)/(x(2)*x(3)*x(5)^4)-0.003*x(4);
c(8)=(((2.85*10^6*x(4))/(x(2)*x(3)))^2+2.4*10^12)^0.5/x(5)^3-5.5;
c(9)=(((2.85*10^6*x(4))/(x(2)*x(3)))^2+6*10^13)^0.5/x(6)^3-5.5;
ceq=[];
myanswer2.m
A=[0 1 0 0 0 0
0 0 1 0 0 0
0 0 0 0 1 0
0 0 0 0 -1 0
0 0 0 0 0 1
0 0 0 0 0 -1];
b=[17;2;100;-150;130;200];
x0=[100.0;20.0;3.0;300.0;60.0;100.0];
[x,fval]=fmincon('myfun2',x0,A,b,[],[],[],[],'mycon2')
这是一个关于传动齿轮设计的优化问题运行后出现以下问题:
>> myanswer2
Warning: Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In E:\MATLAB6p1\toolbox\optim\fmincon.m at line 213
In e:\MATLAB6p1\work\myanswer2.m at line 10
Optimization terminated: No feasible solution found.
Search direction less than 2*options.TolX but constraints are not satisfied.
x =
132.2222
20.0000
3.0000
267.7778
125.0000
116.1111
fval =
1.0275e+007
很明显,这是错的,请问老师哪里有问题???
|
|