g
9
(x) x
6
200 0
g
10
(x) x
1
0.5x
6
x
4
40 0
g
11
(x) 1468250 (x
2
x
3
x
1
) 550 0
g
12
(x)
7098
g
13
(x)
7098
2 2
x
1
x
2
x
3
(0.169 0.666610
2
x
2
0.85410
4
x
2
)
2 2
x
1
x
2
x
3
(0.2824 0.177 10
2
x
2
0.39410
4
x
2
)
400 0
400 0
4 4
g
14
(x) 117.04 x
4
(x
2
x
3
x
5
) 0.003x
4
0
1 2.8510
6
x
4
2
g
15
(x)
3
( ) 2.410
12
5.5 0
x
5
x
2
x
3
1 2.8510
6
x
4
2
g
16
(x)
3
( ) 610
12
5.5 0
x
6
x
2
x
3
5.1.2 运用 Matlab 优化工具箱对数学模型进行程序求解
首先在 Matlab 优化工具箱中编写目标函数的 M 文件 myfun.m,
返回 x 处的函数值 f:
function f = myfun(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)
由于约束条件中有非线性约束,故需要编写一个描述非线性
约束条件的 M 文件 mycon.m:
function[c,ceq]=myobj(x)
c=[17-x(2);0.9-x(1)/(x(2)*x(3));x(1)/(x(2)*x(3))-1.4;2-x(3);x(2)*
x(3)-300;100-x(5);x(5)-150;130-x(6);x(6)-200;x(1)+0.5*x(6)-x(4)-40;
1486250/(x(2)*x(3)*sqrt(x(1)))-550;
7098/(x(1)*x(2)*x(3)^2*(0.169+0.006666*x(2)-0.0000854*x(2)^2))-4
00;7098/(x(1)*x(2)*x(3)^2*(0.2824+0.00177*x(2)-0.0000394*x(2)^2)
)-400;117.04*x(4)^4/(x(2)*x(3)*x(5)^4)-0.003*x(4);(1/(x(5)^3))*sqrt(
(2850000*x(4)/(x(2)*x(3)))^2+2.4*10^12)-5.5;(1/(x(6)^3))*sqrt((2850
000*x(4)/(x(2)*x(3)))^2+6*10^13)-5.5];
ceq=[];
最后在 command window 里输入:
x0=[230;21;8;420;120;160];%给定初始值
4