- 积分
- 46
- 注册时间
- 2007-4-28
- 仿真币
-
- 最后登录
- 1970-1-1
|
发表于 2010-9-19 16:43:27
|
显示全部楼层
来自 河北廊坊
本帖最后由 qibbxxt 于 2010-9-19 16:45 编辑
3# chenbinok
目标函数-
- function y=mufun_ex0919(x)
- y=(x(1)-2).^2+(x(2)-1).^2;
复制代码 约束条件-
- function [c,ceq]=mycon_ex0919(x)
- c=x(1).^2/4+x(2).^2-1;
- ceq=x(1)-2*x(2)+1;
复制代码 运行-
- x = fmincon(@mufun_ex0919,[2,2],[],[],[],[],[],[],@mycon_ex0919,[])
- Warning: Trust-region-reflective method does not currently solve this type of problem,
- using active-set (line search) instead.
- > In fmincon at 439
- Local minimum found that satisfies the constraints.
- Optimization completed because the objective function is non-decreasing in
- feasible directions, to within the default value of the function tolerance,
- and constraints were satisfied to within the default value of the constraint tolerance.
- <stopping criteria details>
- Active inequalities (to within options.TolCon = 1e-006):
- lower upper ineqlin ineqnonlin
- 1
- x =
- 0.8229 0.9114
- >> options=optimset('Algorithm','active-set');x = fmincon(@mufun_ex0919,[2,2],[],[],[],[],[],[],@mycon_ex0919,options)
- Local minimum found that satisfies the constraints.
- Optimization completed because the objective function is non-decreasing in
- feasible directions, to within the default value of the function tolerance,
- and constraints were satisfied to within the default value of the constraint tolerance.
- <stopping criteria details>
- Active inequalities (to within options.TolCon = 1e-006):
- lower upper ineqlin ineqnonlin
- 1
- x =
- 0.8229 0.9114
复制代码
还可以参考参考这个:http://forum.simwe.com/viewthread.php?tid=879437 |
评分
-
1
查看全部评分
-
|