这是非线性规划问题.目标函数为非线性,没有等式和不等式约束条件,x的取值范围为(0,inf)
首先建立m函数如下:
function f=fun1(x)
f=0.026662*(0.000867*x(1)^2+0.004667*x(1))+5.593748*(-0.000184675*x(2)^2+0.0959175*x(2)-9.8812)-3.067962*(-0.1*x(3)^2+x(3)+1.3);
f=-f;
注意matlab提供的工具箱只能求解最小值问题,将最大值问题转换为最小值问题加个负号就行.然后在命令空间输入以下内容:
>> x0=[1;1;1];
>> Aeq=[];Beq=[];A=[];B=[];
>> vlb=[0;0;0];vhb=[];
>> [x,fval]=fmincon('fun1',x0,A,B,Aeq,Beq,vlb,vhb)
Warning:Trust-region-reflective method does not currently solve this type of problem,
using active-set (line search) instead.
> In fmincon at 422
Optimization terminated:magnitude of directional derivative in search
direction less than 2*options.TolFun and maximum constraint violation
is less than options.TolCon.
Active inequalities (to within options.TolCon = 1e-006):
lower upper ineqlin ineqnonlin
3
x =
1.0831
259.6927
0
fval =
-10.4064
所以最终结果x1到x3分别为:1.0831,259.6927,0.
最大值为-(-10.4064)=10.4064
关于非线性规划问题的具体用法可以自行百度之.这里警告提示可能使用的优化方法不合适.