|
全部大于等于0的解
x =
Columns 1 through 4
0.899999952616886 0.449987471977047 1.000006482444359 2.000068541604411
Columns 5 through 8
7.999971440536423 7.999692684210950 5.000031275992702 0.999987723454627
Column 9
2.000052483507424
- function [x,x0]=myfun3
- x0 = unifrnd(-2,2,1,9);
- options=optimset('MaxFunEvals',10000,'MaxIter',5000);
- [x,fval] = fsolve(@f,x0,options) ;
-
- function F=f(x)
- F=[23.3037*x(2)+(1-x(1)*x(2))*x(3)*(exp(x(5)*( 0.485- 0.0052095*x(7)- 0.0285132*x(8)))-1)- 28.5132;
- - 28.5132*x(1)+(1-x(1)*x(2))*x(4)*(exp(x(6)*( 0.116- 0.0052095*x(7)+ 0.0233037*x(9)))-1)+ 23.3037;
- 101.779*x(2)+(1-x(1)*x(2))*x(3)*(exp(x(5)*( 0.752- 0.0100677*x(7)- 0.1118467*x(8)))-1)- 111.8467;
- - 111.8467*x(1)+(1-x(1)*x(2))*x(4)*(exp(x(6)*(- 0.502- 0.0100677*x(7)+ 0.101779*x(9)))-1)+ 101.779;
- 111.461*x(2)+(1-x(1)*x(2))*x(3)*(exp(x(5)*( 0.869- 0.0229274*x(7)- 0.1343884*x(8)))-1)- 134.3884;
- - 134.3884*x(1)+(1-x(1)*x(2))*x(4)*(exp(x(6)*( 0.166- 0.0229274*x(7)+ 0.111461*x(9)))-1)+ 111.461;
- 191.267*x(2)+(1-x(1)*x(2))*x(3)*(exp(x(5)*( 0.982- 0.0202153*x(7)-0.2114823*x(8)))-1)-211.4823;
- - 211.4823*x(1)+(1-x(1)*x(2))*x(4)*(exp(x(6)*(- 0.473- 0.0202153*x(7)+ 0.191267*x(9)))-1)+ 191.267;
- x(1)*x(3)-x(2)*x(4)];
- end
- end
- 用while sum(x>=0)~=9
- [x,x0]=myfun3;
- end
- 15次找到该解,其中还得到其它的解。
复制代码 |
|