全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 MATLAB等数学软件专版
1429 1
2011-05-26
下面是matlab里给出的一个例子,在MATLAB完整的程序应该是什么样的?非常谢谢

Find values of x that minimize f(x) = –x1x2x3,starting at the point x = [10;10;10],subject to the constraints:
0 ≤ x1 +2x2 + 2x3 ≤72.
  • Write a file that returns a scalar value f ofthe objective function evaluated at x:
    function f = myfun(x)f = -x(1) * x(2) * x(3);
  • Rewrite the constraints as both less than or equalto a constant,
    x1–2x2–2x3 ≤0
    x1 + 2x2 +2x3≤ 72
  • Since both constraints are linear, formulate themas the matrix inequality A·xb,where
    A = [-1 -2 -2; ...      1  2  2];b = [0;72];
  • Supply a starting point and invoke an optimizationroutine:
    x0 = [10;10;10];    % Starting guess at the solution[x,fval] = fmincon(@myfun,x0,A,b);
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2011-5-26 12:55:42
fmincon
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群