24小时热门版块排行榜    

查看: 604  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 不应该看fileCode +4 且听虎啸 2026-08-12 4/200 2026-08-12 12:40 by 行无人
[基金申请] 2019年青年基金涵评意见,大家看看几个A,几个B? +5 Tide man 2026-08-11 5/250 2026-08-12 09:24 by kangban
[论文投稿] 职称评审,求友友推荐见刊最快的期刊 +4 工厂打螺丝 2026-08-08 4/200 2026-08-12 09:18 by hansi2025
[基金申请] 综述论文作为代表作会不会影响评审专家的印象分? +11 yufeiwaner 2026-08-09 13/650 2026-08-12 08:17 by yufeiwaner
[基金申请] 是这周出结果还是下周出结果? +3 yuleib84 2026-08-11 3/150 2026-08-11 21:53 by jnhyjjm
[基金申请] 有时候,自然基金真的不能太认真 (我的申报经验) +3 majunge000 2026-08-11 4/200 2026-08-11 20:13 by lch2012
[基金申请] 为什么网上很多人说本周 12号出结果 +6 瞬息宇宙 2026-08-10 7/350 2026-08-11 19:25 by Tide man
[硕博家园] 读博的好处 +3 lnee 2026-08-11 3/150 2026-08-11 18:10 by 希望我好好的
[基金申请] 什么时候出结果,有咨询渠道??? +3 Tide man 2026-08-11 3/150 2026-08-11 17:54 by kudofaye
[基金申请] 分享一下我之前已中青C的计划书的filecode +3 布布和一二 2026-08-11 4/200 2026-08-11 15:20 by aasahr
[基金申请] 基金中了 +15 laoda193707 2026-08-06 15/750 2026-08-11 00:11 by jiafei2190
[基金申请] 确定了,国自然21号放榜 +6 布布和一二 2026-08-10 7/350 2026-08-10 19:15 by 2000zf36392
[基金申请] 静等基金结果 +5 gjjjzhong 2026-08-10 16/800 2026-08-10 17:19 by Tide man
[基金申请] 据悉今年马上要出结果了 +7 瞬息宇宙 2026-08-10 8/400 2026-08-10 12:42 by Vivilian
[基金申请] 这样的filecode谁见过 +11 布布和一二 2026-08-08 22/1100 2026-08-10 11:10 by wmfsnow
[基金申请] 关于filecode,很负责任的告诉大家 +6 爱看书的可乐 2026-08-08 7/350 2026-08-08 22:13 by a_niu
[基金申请] 国基金的申报应该改成非等额制,评价高的钱多评价低的钱少,但是增加资助率 +7 a089 2026-08-07 7/350 2026-08-08 18:05 by gltch
[基金申请] 化学口download_prp&amp;fileCode的固定段好像这几天一直没变,有变的大神么? +3 Tide man 2026-08-07 4/200 2026-08-07 22:39 by Tide man
[基金申请] filecode +14 等待解的谜 2026-08-06 19/950 2026-08-07 12:20 by wlwhappy
[基金申请] filecode +8 布布和一二 2026-08-06 11/550 2026-08-06 20:41 by tangpu318
信息提示
请填处理意见