24小时热门版块排行榜    

查看: 605  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 长年满屏的广告,版主太不责任了。基金也等的急 +3 gltch 2026-08-12 3/150 2026-08-12 13:25 by dcqxinyang
[基金申请] filecode +11 documentary 2026-08-10 12/600 2026-08-12 12:42 by kudofaye
[基金申请] FileCode能看出啥? +7 要乐观耀哥 2026-08-10 19/950 2026-08-12 10:55 by 要乐观耀哥
[基金申请] 2019年青年基金涵评意见,大家看看几个A,几个B? +5 Tide man 2026-08-11 5/250 2026-08-12 09:24 by kangban
[基金申请] 综述论文作为代表作会不会影响评审专家的印象分? +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 lnee 2026-08-11 3/150 2026-08-11 18:10 by 希望我好好的
[基金申请] 基金中了 +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
[基金申请] 2026国自然放榜时间 +9 布布和一二 2026-08-08 9/450 2026-08-10 11:22 by xxxx2020
[基金申请] 面上项目filecode邪修 +5 西山十月 2026-08-09 7/350 2026-08-10 07:32 by 仁砚薪传
[基金申请] filecode与中标关系的预测 +5 布布和一二 2026-08-07 5/250 2026-08-09 16:15 by 袁向阳007
[基金申请] fileCode有新解读? +10 Tide man 2026-08-08 18/900 2026-08-09 12:55 by 仁砚薪传
[基金申请] 关于豆爷回答的JTJC与%2F数量 +5 yang182083 2026-08-06 7/350 2026-08-08 18:29 by zhanghaozhu
[基金申请] 国基金的申报应该改成非等额制,评价高的钱多评价低的钱少,但是增加资助率 +7 a089 2026-08-07 7/350 2026-08-08 18:05 by gltch
[基金申请] 关于filecode +4 布布和一二 2026-08-07 7/350 2026-08-07 22:55 by zhanghaozhu
[基金申请] 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
信息提示
请填处理意见