24小时热门版块排行榜    

查看: 1818  |  回复: 12

iwill1k

铜虫 (小有名气)

[求助] 多元函数求最值

刚接触matlab,我想用matlab求下面函数的最大、最小值以及取最值的时候自变量取值,是一个有4个自变量的函数,自变量都有一定的变化范围。具体函数是:
f=[d*(s+b+d)+0.858*r*r-0.858*(r+d/2)*(r+d/2)]/[s*b-0.858*r*r];其中,2.79≤s≤2.83;7.97≤b≤8.07;0.13≤d≤0.18;0.6≤r≤1.有木有大神帮帮忙知道一下啊
回复此楼

» 猜你喜欢

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

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

lijie169

铜虫 (著名写手)

【答案】应助回帖

感谢参与,应助指数 +1
百度你会不?http://www.google.com.hk/#hl=zh- ... rgbld.&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=b7e86341b10bb823&biw=1366&bih=667
2楼2012-04-09 11:43:42
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

感谢参与,应助指数 +1
>> f=@(x)(x(3).*(x(1)+x(2)+x(3))+0.858*x(4).*x(4)-0.858*(x(4)+x(3)/2).*(x(4)+x(3)/2))./(x(1).*x(2)-0.858*x(4).*x(4));
  opt=optimset('Algorithm','interior-point');
[X,FVAL,EXITFLAG]= fmincon(f,[2.8 8 0.15 0.8],[],[],[],[],[2.79 7.97 0.13 0.6],[2.83 8.07 0.18 1],[],opt)

Local minimum found that satisfies the constraints.

Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the function tolerance,
and constraints were satisfied to within the default value of the constraint tolerance.




X =

    2.8300    8.0700    0.1300    0.9998


FVAL =

    0.0600


EXITFLAG =

     1

>> f1=@(x)-(x(3).*(x(1)+x(2)+x(3))+0.858*x(4).*x(4)-0.858*(x(4)+x(3)/2).*(x(4)+x(3)/2))./(x(1).*x(2)-0.858*x(4).*x(4));
>> [X,FVAL,EXITFLAG]= fmincon(f1,[2.8 8 0.15 0.8],[],[],[],[],[2.79 7.97 0.13 0.6],[2.83 8.07 0.18 1],[],opt)

Local minimum found that satisfies the constraints.

Optimization completed because the objective function is non-decreasing in
feasible directions, to within the default value of the function tolerance,
and constraints were satisfied to within the default value of the constraint tolerance.




X =

    2.7900    7.9700    0.1800    0.6000


FVAL =

   -0.0853


EXITFLAG =

     1
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.
3楼2012-04-09 12:35:37
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yqx1985

木虫 (著名写手)

云中仙

楼上正解
给你贴个1stOpt的
Parameters s[2.79,2.83], b[7.97,8.07],d[0.13,0.18],r[0.6,1];
Minimum =f;
Function f=(d*(s+b+d)+0.858*r*r-0.858*(r+d/2)*(r+d/2))/(s*b-0.858*r*r);
====== 结果 ======

迭代数: 18
计算用时(时:分:秒:毫秒): 00:00:00:94
计算中止原因: 达到收敛判定标准
优化算法: 共扼梯度法 + 通用全局优化法
函数表达式: (d*(s+b+d)+0.858*r*r-0.858*(r+d/2)*(r+d/2))/(s*b-0.858*r*r)
目标函数值(最小): 0
s: 2.82999999999992
b: 8.06833196340274
d: 0
r: 0.830131999171392

====== 计算结束 ======
人面不知何时去,桃花依旧笑春风
4楼2012-04-09 13:43:37
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

iwill1k

铜虫 (小有名气)

引用回帖:
4楼: Originally posted by yqx1985 at 2012-04-09 13:43:37:
楼上正解
给你贴个1stOpt的
Parameters s, b,d,r;
Minimum =f;
Function f=(d*(s+b+d)+0.858*r*r-0.858*(r+d/2)*(r+d/2))/(s*b-0.858*r*r);
====== 结果 ======

迭代数: 18
计算用时(时:分:秒:毫秒):  ...

输出结果里面d=0,但是d没有0这个取值啊。。
5楼2012-04-09 13:55:18
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

iwill1k

铜虫 (小有名气)

引用回帖:
3楼: Originally posted by dbb627 at 2012-04-09 12:35:37:
>> f=@(x)(x(3).*(x(1)+x(2)+x(3))+0.858*x(4).*x(4)-0.858*(x(4)+x(3)/2).*(x(4)+x(3)/2))./(x(1).*x(2)-0.858*x(4).*x(4));
  opt=optimset('Algorithm','interior-point');
= fmincon(f,,[],[],[],[], ...

能解释一下么。。。
6楼2012-04-09 14:02:42
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

引用回帖:
6楼: Originally posted by iwill1k at 2012-04-09 14:02:42:
能解释一下么。。。

这个需要解释什么?,x1-4对应s b d r,
至于fmincon,你看下matlab的帮助就明白了
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.
7楼2012-04-09 17:00:48
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yqx1985

木虫 (著名写手)

云中仙

【答案】应助回帖

★ ★ ★
感谢参与,应助指数 +1
iwill1k: 金币+3, ★★★★★最佳答案 2012-04-14 11:14:40
引用回帖:
5楼: Originally posted by iwill1k at 2012-04-09 13:55:18:
输出结果里面d=0,但是d没有0这个取值啊。。

的却如此呢,1stOpt给的这个结果的确奇怪,我又试了次
====== 结果 ======

迭代数: 17
计算用时(时:分:秒:毫秒): 00:00:00:125
计算中止原因: 达到收敛判定标准
优化算法: 共扼梯度法 + 通用全局优化法
函数表达式: (d*(s+b+d)+0.858*r*r-0.858*(r+d/2)*(r+d/2))/(s*b-0.858*r*r)
目标函数值(最小): 0.0599967759074685
s: 2.82999099858591
b: 8.06997582502897
d: 0.130000407383572
r: 0.999995774967586

====== 计算结束 ======
人面不知何时去,桃花依旧笑春风
8楼2012-04-10 11:14:50
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

iwill1k

铜虫 (小有名气)

引用回帖:
3楼: Originally posted by dbb627 at 2012-04-09 12:35:37:
>> f=@(x)(x(3).*(x(1)+x(2)+x(3))+0.858*x(4).*x(4)-0.858*(x(4)+x(3)/2).*(x(4)+x(3)/2))./(x(1).*x(2)-0.858*x(4).*x(4));
  opt=optimset('Algorithm','interior-point');
= fmincon(f,,[],[],[],[], ...

弱弱的问一下,[X,FVAL,EXITFLAG]= fmincon(f,[2.8 8 0.15 0.8],[],[],[],[],[2.79 7.97 0.13 0.6],[2.83 8.07 0.18 1],[],opt)里面的[2.8 8 0.15 0.8]是算的定义域里面的平均值吗?
9楼2012-04-10 12:28:24
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

引用回帖:
9楼: Originally posted by iwill1k at 2012-04-10 12:28:24:
弱弱的问一下,= fmincon(f,,[],[],[],[],,,[],opt)里面的是算的定义域里面的平均值吗?

不是,[2.8 8 0.15 0.8]是用来计算的初始值
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.
10楼2012-04-10 14:03:40
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 iwill1k 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 284求调剂 +8 天下熯 2026-02-28 8/400 2026-03-02 00:15 by 暮雨星晴
[考研] 材料学硕318求调剂 +5 February_Feb 2026-03-01 5/250 2026-03-01 23:31 by L135790
[考研] 292求调剂 +6 yhk_819 2026-02-28 6/300 2026-03-01 23:23 by 向上的胖东
[考研] 265分求调剂不调专业和学校有行学上就 +6 礼堂丁真258 2026-02-28 8/400 2026-03-01 22:50 by jian_
[考研] 0856调剂 +5 刘梦微 2026-02-28 5/250 2026-03-01 22:30 by wang_dand
[考研] 299求调剂 +3 Y墨明棋妙Y 2026-02-28 5/250 2026-03-01 21:01 by tangxiaotian
[考研] 306分材料调剂 +4 chuanzhu川烛 2026-03-01 5/250 2026-03-01 19:48 by 无际的草原
[考研] 272求调剂 +6 材紫有化 2026-02-28 6/300 2026-03-01 18:58 by 18137688336
[考研] 295求调剂 +7 19171856320 2026-02-28 7/350 2026-03-01 18:54 by 18137688336
[考研] 材料学调剂 +9 提神豆沙包 2026-02-28 11/550 2026-03-01 18:15 by ms629
[考博] 26申博 +4 想申博! 2026-02-26 6/300 2026-03-01 17:32 by 想申博!
[考研] 化工专硕348,一志愿985求调剂 +5 弗格个 2026-02-28 8/400 2026-03-01 17:25 by sunny81
[考研] 化工专硕342,一志愿大连理工大学,求调剂 +3 kyf化工 2026-02-28 4/200 2026-03-01 16:49 by yywzz
[考研] 304求调剂 +6 曼殊2266 2026-02-28 7/350 2026-03-01 15:14 by wjLi2017
[考研] 材料工程274求调剂 +3 Lilithan 2026-03-01 3/150 2026-03-01 14:58 by ms629
[考研] 调剂 +3 简木ChuFront 2026-02-28 3/150 2026-03-01 11:46 by 王伟要上岸啊
[考研] 317一志愿华南理工电气工程求调剂 +6 Soliloquy_Q 2026-02-28 11/550 2026-03-01 11:14 by 歌liekkas
[论文投稿] 求助coordination chemistry reviews 的写作模板 10+3 ljplijiapeng 2026-02-27 4/200 2026-03-01 09:07 by babero
[考研] 307求调剂 +4 73372112 2026-02-28 6/300 2026-03-01 00:04 by ll247
[考研] 085600材料工程一志愿中科大总分312求调剂 +8 吃宵夜1 2026-02-28 10/500 2026-02-28 20:27 by L135790
信息提示
请填处理意见