24小时热门版块排行榜    

查看: 606  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 应该是93bebmhtak前后十一个字符比较关键 +22 Lanmanbaby 2026-08-09 35/1750 2026-08-12 14:38 by sdfapple719
[基金申请] 长年满屏的广告,版主太不责任了。基金也等的急 +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
[基金申请] 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
[基金申请] 小木虫上这么多卖论文的,真有人买论文么?感觉没必要啊 +8 Tide man 2026-08-10 9/450 2026-08-11 20:39 by beefly
[基金申请] 帮忙看看fileCode +7 wwncly 2026-08-10 13/650 2026-08-11 19:36 by 冰心玉壶晴
[基金申请] 我的国基提前知道中了,可是同事的操作让我实在接受不了,怎么会有这样的人 +8 家与远方 2026-08-10 13/650 2026-08-11 09:49 by 家与远方
[基金申请] 基金中了 +15 laoda193707 2026-08-06 15/750 2026-08-11 00:11 by jiafei2190
[基金申请] 关于代码变化问题,想知道的进来 +17 且听虎啸 2026-08-07 24/1200 2026-08-10 18:35 by zhangduo2008
[基金申请] 静等基金结果 +5 gjjjzhong 2026-08-10 16/800 2026-08-10 17:19 by Tide man
[基金申请] 国基金的申报应该改成非等额制,评价高的钱多评价低的钱少,但是增加资助率 +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
[基金申请] 固定端突然变了,今天 +6 archvillain 2026-08-06 10/500 2026-08-07 16:03 by 医学老男孩
[基金申请] filecode变化情况 +6 布布和一二 2026-08-07 22/1100 2026-08-07 14:45 by 且听虎啸
[基金申请] 大家散了吧,后缀研究没有意义,别浪费时间了,过好目前的每一天,不要焦虑 +5 Tide man 2026-08-06 7/350 2026-08-07 13:11 by 医学老男孩
[基金申请] filecode +8 布布和一二 2026-08-06 11/550 2026-08-06 20:41 by tangpu318
[基金申请] 影响面上的因素 +8 布布和一二 2026-08-05 11/550 2026-08-06 10:41 by 宝贝虫子
信息提示
请填处理意见