| 查看: 1825 | 回復(fù): 12 | ||||
[求助]
多元函數(shù)求最值
|
|
剛接觸matlab,我想用matlab求下面函數(shù)的最大、最小值以及取最值的時候自變量取值,是一個有4個自變量的函數(shù),自變量都有一定的變化范圍。具體函數(shù)是: 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.有木有大神幫幫忙知道一下啊 |
| 百度你會不?http://www.google.com.hk/#hl=zh- ... rgbld.&bav=on.2,or.r_gc.r_pw.,cf.osb&fp=b7e86341b10bb823&biw=1366&bih=667 |
榮譽版主 (著名寫手)
![]() |
專家經(jīng)驗: +4 |
|
>> 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 |

木蟲 (著名寫手)
云中仙
樓上正解![]() 給你貼個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); ====== 結(jié)果 ====== 迭代數(shù): 18 計算用時(時:分:秒:毫秒): 00:00:00:94 計算中止原因: 達到收斂判定標準 優(yōu)化算法: 共扼梯度法 + 通用全局優(yōu)化法 函數(shù)表達式: (d*(s+b+d)+0.858*r*r-0.858*(r+d/2)*(r+d/2))/(s*b-0.858*r*r) 目標函數(shù)值(最小): 0 s: 2.82999999999992 b: 8.06833196340274 d: 0 r: 0.830131999171392 ====== 計算結(jié)束 ====== |

榮譽版主 (著名寫手)
![]() |
專家經(jīng)驗: +4 |

木蟲 (著名寫手)
云中仙
|
的卻如此呢,1stOpt給的這個結(jié)果的確奇怪,我又試了次 ====== 結(jié)果 ====== 迭代數(shù): 17 計算用時(時:分:秒:毫秒): 00:00:00:125 計算中止原因: 達到收斂判定標準 優(yōu)化算法: 共扼梯度法 + 通用全局優(yōu)化法 函數(shù)表達式: (d*(s+b+d)+0.858*r*r-0.858*(r+d/2)*(r+d/2))/(s*b-0.858*r*r) 目標函數(shù)值(最小): 0.0599967759074685 s: 2.82999099858591 b: 8.06997582502897 d: 0.130000407383572 r: 0.999995774967586 ====== 計算結(jié)束 ====== |

榮譽版主 (著名寫手)
![]() |
專家經(jīng)驗: +4 |

| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 材料專碩306英一數(shù)二 +8 | z1z2z3879 2026-03-16 | 10/500 |
|
|---|---|---|---|---|
|
[考研] 一志愿天津大學(xué)化學(xué)工藝專業(yè)(081702)315分求調(diào)劑 +7 | yangfz 2026-03-17 | 7/350 |
|
|
[基金申請] 被我言中:新模板不強調(diào)格式了,假專家開始管格式了 +4 | beefly 2026-03-14 | 4/200 |
|
|
[考研] 材料與化工求調(diào)劑 +6 | 為學(xué)666 2026-03-16 | 6/300 |
|
|
[考研] 【0856】化學(xué)工程(085602)313 分,本科學(xué)科評估A類院;瘜W(xué)工程與工藝,誠求調(diào)劑 +7 | 小劉快快上岸 2026-03-11 | 8/400 |
|
|
[考研] 工科材料085601 279求調(diào)劑 +3 | 困于星晨 2026-03-17 | 3/150 |
|
|
[考研] 271求調(diào)劑 +12 | 生如夏花… 2026-03-11 | 14/700 |
|
|
[考研] 考研調(diào)劑 +3 | 淇ya_~ 2026-03-17 | 5/250 |
|
|
[考研] 藥學(xué)383 求調(diào)劑 +3 | 藥學(xué)chy 2026-03-15 | 4/200 |
|
|
[考研] 333求調(diào)劑 +3 | 文思客 2026-03-16 | 7/350 |
|
|
[考研] 304求調(diào)劑 +4 | ahbd 2026-03-14 | 4/200 |
|
|
[考研] 304求調(diào)劑 +3 | 曼殊2266 2026-03-14 | 3/150 |
|
|
[考研] 283求調(diào)劑 +10 | 小樓。 2026-03-12 | 14/700 |
|
|
[考研] 085600調(diào)劑 +5 | 漾漾123sun 2026-03-12 | 6/300 |
|
|
[考研] 331求調(diào)劑(0703有機化學(xué) +5 | ZY-05 2026-03-13 | 6/300 |
|
|
[考研] 求調(diào)劑(材料與化工327) +4 | 愛吃香菜啦 2026-03-11 | 4/200 |
|
|
[考研] 一志愿211化學(xué)學(xué)碩310分求調(diào)劑 +8 | 努力奮斗112 2026-03-12 | 9/450 |
|
|
[考研] 085600材料與化工 309分請求調(diào)劑 +7 | dtdxzxx 2026-03-12 | 8/400 |
|
|
[考研] 308求調(diào)劑 +3 | 是Lupa啊 2026-03-12 | 3/150 |
|
|
[考研] 270求調(diào)劑 085600材料與化工專碩 +3 | YXCT 2026-03-11 | 3/150 |
|