24小时热门版块排行榜    

查看: 548  |  回复: 3

524633857

木虫 (小有名气)

[求助] 多元函数求最大值

这个不属于前沿,属于研究方法,注意发贴分类,已经帮你修改了
方程y=94.011+3.886*x(1)+1.842*x(2)+3.052*x(3)+3.063*x(4)-2.255*x(1)^2-0.773*x(2)^2-0.748*x(3)^2-3.079*x(4)^2-1.802*x(1)*x(2)-1.526*x(1)*x(3)+1.180*x(1)*x(4)-2.246*x(2)*x(3)-1.102*x(2)*x(4)-1.146*x(3)*x(4)  在区间【2,2】,y<100 条件下的最大值是多少,高手能不能帮忙求一下,直接给出x和y的值分别是多少?(

[ Last edited by dbb627 on 2011-10-16 at 00:01 ]
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

524633857(金币+20): 2011-10-13 15:58:56
cenwanglai(计算强帖-1): 2011-10-13 17:09:05
cenwanglai(计算强帖+1): 2011-10-13 17:09:26
CODE:
function aa
y=@(x)94.011+3.886*x(1)+1.842*x(2)+3.052*x(3)+3.063*x(4)...
    -2.255*x(1)^2-0.773*x(2)^2-0.748*x(3)^2-3.079*x(4)^2-...
    1.802*x(1)*x(2)-1.526*x(1)*x(3)+1.180*x(1)*x(4)-2.246*x(2)*x(3)-1.102*x(2)*x(4)-1.146*x(3)*x(4);
y1=@(x)(-(94.011+3.886*x(1)+1.842*x(2)+3.052*x(3)+3.063*x(4)...
    -2.255*x(1).^2-0.773*x(2).^2-0.748*x(3).^2-3.079*x(4).^2-...
    1.802*x(1).*x(2)-1.526*x(1).*x(3)+1.180*x(1).*x(4)-2.246*x(2).*x(3)-1.102*x(2).*x(4)-1.146*x(3).*x(4))+100).^2;
[X,FVAL,EXITFLAG] =fmincon(y1,[1 1 0.5 1],[],[],[],[],[-2 -2 -2 -2],[2 2 2 2],@(x)con(x))
feval(y,X)

function [c,cq]=con(x)
c=94.011+3.886*x(1)+1.842*x(2)+3.052*x(3)+3.063*x(4)...
    -2.255*x(1)^2-0.773*x(2)^2-0.748*x(3)^2-3.079*x(4)^2-...
    1.802*x(1)*x(2)-1.526*x(1)*x(3)+1.180*x(1)*x(4)-2.246*x(2)*x(3)-1.102*x(2)*x(4)-1.146*x(3)*x(4)-100;
cq=[];

结果
Warning: Trust-region-reflective algorithm does not solve this type of problem, using
active-set algorithm. You could also try the interior-point or sqp algorithms: set the
Algorithm option to 'interior-point' or 'sqp' and rerun. For more help, see Choosing the
Algorithm in the documentation.
> In fmincon at 472
  In AAAA at 8

Local minimum possible. Constraints satisfied.

fmincon stopped because the predicted change in the objective function
is less than the default value of the function tolerance and constraints
were satisfied to within the default value of the constraint tolerance.



Active inequalities (to within options.TolCon = 1e-006):
  lower      upper     ineqlin   ineqnonlin
    2                                 

X =

    1.5853   -2.0000    0.7306    0.9674


FVAL =

  2.7821e-009


EXITFLAG =

     5


ans =

   99.9999

» 本帖已获得的红花(最新10朵)

The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
2楼2011-10-13 14:50:07
已阅   关注TA 给TA发消息 送TA红花 TA的回帖

524633857

木虫 (小有名气)

送鲜花一朵
引用回帖:
2楼: Originally posted by dbb627 at 2011-10-13 14:50:07:
[code] function aa
y=@(x)94.011+3.886*x(1)+1.842*x(2)+3.052*x(3)+3.063*x(4)...
    -2.255*x(1)^2-0.773*x(2)^2-0.748*x(3)^2-3.079*x(4)^2-...
    1.802*x(1)*x(2)-1.526*x(1)*x(3)+1.180*x(1)*x(4)-2. ...

谢谢[X,FVAL,EXITFLAG] =fmincon(y1,[1 1 0.5 1],[],[],[],[],[-2 -2 -2 -2],[2 2 2 2],@(x)con(x))
请问,[1 1 0.5 1]的作用是什么
3楼2011-10-13 16:01:33
已阅   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

迭代计算的初值
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
4楼2011-10-13 16:08:01
已阅   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 524633857 的主题更新
信息提示
请填处理意见