| 查看: 1827 | 回復(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 計算中止原因: 達(dá)到收斂判定標(biāo)準(zhǔn) 優(yōu)化算法: 共扼梯度法 + 通用全局優(yōu)化法 函數(shù)表達(dá)式: (d*(s+b+d)+0.858*r*r-0.858*(r+d/2)*(r+d/2))/(s*b-0.858*r*r) 目標(biāo)函數(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 計算中止原因: 達(dá)到收斂判定標(biāo)準(zhǔn) 優(yōu)化算法: 共扼梯度法 + 通用全局優(yōu)化法 函數(shù)表達(dá)式: (d*(s+b+d)+0.858*r*r-0.858*(r+d/2)*(r+d/2))/(s*b-0.858*r*r) 目標(biāo)函數(shù)值(最小): 0.0599967759074685 s: 2.82999099858591 b: 8.06997582502897 d: 0.130000407383572 r: 0.999995774967586 ====== 計算結(jié)束 ====== |

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

| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 344求調(diào)劑 +5 | knight344 2026-03-16 | 6/300 |
|
|---|---|---|---|---|
|
[考研] 286求調(diào)劑 +5 | lemonzzn 2026-03-16 | 8/400 |
|
|
[考研]
|
.6lL 2026-03-18 | 3/150 |
|
|
[考研] 一志愿武理材料305分求調(diào)劑 +3 | 想上岸的鯉魚 2026-03-18 | 4/200 |
|
|
[考研] 0703化學(xué)調(diào)劑 ,六級已過,有科研經(jīng)歷 +10 | 曦熙兮 2026-03-15 | 10/500 |
|
|
[考研] 收復(fù)試調(diào)劑生 +4 | 雨后秋荷 2026-03-18 | 4/200 |
|
|
[考研] 312求調(diào)劑 +8 | 陌宸希 2026-03-16 | 9/450 |
|
|
[考研] 材料,紡織,生物(0856、0710),化學(xué)招生啦 +3 | Eember. 2026-03-17 | 9/450 |
|
|
[考研] 302求調(diào)劑 +9 | 負(fù)心者當(dāng)誅 2026-03-11 | 9/450 |
|
|
[考研] 本人考085602 化學(xué)工程 專碩 +16 | 不知道叫什么! 2026-03-15 | 18/900 |
|
|
[考研] 293求調(diào)劑 +6 | 世界首富 2026-03-11 | 6/300 |
|
|
[考研] 材料工程專碩274一志愿211求調(diào)劑 +6 | 薛云鵬 2026-03-15 | 6/300 |
|
|
[考研] 278求調(diào)劑 +3 | Yy7400 2026-03-13 | 3/150 |
|
|
[考研] 085600調(diào)劑 +5 | 漾漾123sun 2026-03-12 | 6/300 |
|
|
[考研] 285求調(diào)劑 +6 | ytter 2026-03-12 | 6/300 |
|
|
[考研] 294求調(diào)劑 +3 | Zys010410@ 2026-03-13 | 4/200 |
|
|
[考研] 297一志愿上交085600求調(diào)劑 +5 | 指尖八千里 2026-03-14 | 5/250 |
|
|
[考研] 330求調(diào)劑 +3 | ?醬給調(diào)劑跪了 2026-03-13 | 3/150 |
|
|
[考研] 一志愿211化學(xué)學(xué)碩310分求調(diào)劑 +8 | 努力奮斗112 2026-03-12 | 9/450 |
|
|
[論文投稿]
投稿問題
5+4
|
星光燦爛xt 2026-03-12 | 6/300 |
|