| 5 | 1/1 | 返回列表 |
| 查看: 1892 | 回復(fù): 12 | ||
| 當(dāng)前只顯示滿足指定條件的回帖,點擊這里查看本話題的所有回帖 | ||
我無恥又無賴木蟲 (著名寫手)
|
[求助]
matlab全局優(yōu)化參數(shù) 已有2人參與
|
|
小弟在用matlab優(yōu)化參數(shù)的時候遇到了一個問題,我用的是fmincon函數(shù),但是因為選不到合適的初值所以得到的結(jié)果不是很滿意,所以想著用全局優(yōu)化的算法來試一下,奈何不太會,希望論壇里的大佬們看一下能不能解決這個問題。我直接把程序復(fù)制到下面了![]() clear all clc data=[288.05 0.000257 0.3003 293.05 0.000274 0.3003 298.2 0.000281 0.3003 303.25 0.000294 0.3003 308.15 0.000305 0.3003 313.25 0.000326 0.3003 318.2 0.000345 0.3003 323.15 0.00039 0.3003 288.05 0.000493 0.3995 293.05 0.00051 0.3995 298.2 0.000532 0.3995 303.25 0.000562 0.3995 308.15 0.00061 0.3995 313.25 0.000641 0.3995 318.2 0.000698 0.3995 323.15 0.000845 0.3995 288.05 0.000877 0.501 293.05 0.00092 0.501 298.2 0.00099 0.501 303.25 0.00115 0.501 308.15 0.00127 0.501 313.25 0.00139 0.501 318.2 0.00157 0.501 323.15 0.00189 0.501 288.05 0.0016 0.5998 293.05 0.00172 0.5998 298.2 0.00196 0.5998 303.25 0.00232 0.5998 308.15 0.00252 0.5998 313.25 0.00281 0.5998 318.2 0.0032 0.5998 323.15 0.00358 0.5998 288.05 0.00293 0.7009 293.05 0.00309 0.7009 298.2 0.00357 0.7009 303.25 0.00424 0.7009 308.15 0.00474 0.7009 313.25 0.00535 0.7009 318.2 0.00611 0.7009 323.15 0.00711 0.7009 288.05 0.0048 0.8003 293.05 0.00548 0.8003 298.2 0.00638 0.8003 303.25 0.0078 0.8003 308.15 0.00863 0.8003 313.25 0.00988 0.8003 318.2 0.0112 0.8003 323.15 0.0128 0.8003 288.05 0.0103 0.8999 293.05 0.0112 0.8999 298.2 0.0121 0.8999 303.25 0.014 0.8999 308.15 0.0152 0.8999 313.25 0.0173 0.8999 318.2 0.0193 0.8999 323.15 0.022 0.8999]; T=data(:,1); xexp=data(:,2); w=data(:,3); deltaH=46266;%熔融焓 R=8.314; Tm=532.34;%熔點 yexp=exp((deltaH./(R.*T)).*(T./Tm-1)-log(xexp)); n=size(T,1); k0=[-3125.70317518255,-2378.98766584565,5092.47952427953,-718.563001024490,-1495.43799248924,-1965.61341412590,0.899991420305235,0.100010845691102,0.219058309329965]; lb=[-inf -inf -inf -inf -inf -inf 0.1 0.1 0.1]; ub=[inf inf inf inf inf inf 0.9 0.9 0.9]; [k,fval,flag] = fmincon(@myfun,k0,[],[],[],[],lb,ub,[],[],xexp,yexp,T,w,n,R); display(fval); display(k); function f = myfun(k,xexp,yexp,T,w,n,R) %a12=k(1) %a21=k(2) %b12=k(3) %b21=k(4) %c12=k(5) %c21=k(6) %o=k(7) %p=k(8) %q=k(9) tao12=k(1)./(R*T); tao21=k(2)./(R*T); tao13=k(3)./(R*T); tao31=k(4)./(R*T); tao23=k(5)./(R*T); tao32=k(6)./(R*T); G12=exp(-k(7).*tao12); G21=exp(-k(7).*tao21); G23=exp(-k(8).*tao23); G32=exp(-k(8).*tao32); G13=exp(-k(9).*tao13); G31=exp(-k(9).*tao31); x2=(1-xexp).*w; x3=(1-xexp).*(1-w); temp1=x2.*G21+x3.*G32; temp2=tao21.*G21.*x2+tao31.*G31.*x3; temp3=(xexp+x2.*G21+x3.*G31).^2; temp4=tao12.*G12.*(x2.^2); temp5=G12.*G32.*x2.*x3.*(tao12-tao32); temp6=(x2+xexp.*G12+x3.*G32).^2; temp7=tao13.*G13.*(x3.^2); temp8=G13.*G23.*x2.*x3.*(tao13-tao23); temp9=(x3+x2.*G23+xexp.*G13).^2; lngamma1=((temp1.*temp2)./temp3)+((temp4+temp5)./temp6)+((temp7+temp8)./temp9); ycal=exp(lngamma1); f=100*sum(abs((yexp-ycal)./(yexp)))./n; end |
木蟲 (著名寫手)
鐵桿木蟲 (職業(yè)作家)
至尊木蟲 (著名寫手)

木蟲 (著名寫手)
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 歡迎采礦、地質(zhì)、巖土、計算機、人工智能等專業(yè)的同學(xué)報考 +8 | pin8023 2026-02-28 | 11/550 |
|
|---|---|---|---|---|
|
[考研]
|
旅行中的紫葡萄 2026-03-03 | 4/200 |
|
|
[考研] 學(xué)碩材料275調(diào)劑 +4 | 路三三 2026-03-03 | 4/200 |
|
|
[基金申請] 請問大家,研究風(fēng)險與應(yīng)對措施那里, 大家都怎么寫呢 ? +3 | cauasen 2026-03-02 | 3/150 |
|
|
[考研] 298求調(diào)劑 +3 | 人間唯你是清歡 2026-03-03 | 4/200 |
|
|
[考研] 085600材料與化工 298 調(diào)劑 +3 | 小西笑嘻嘻 2026-03-03 | 3/150 |
|
|
[考研] 085602化學(xué)工程350,調(diào)劑,有沒有211的 +5 | 利好利好. 2026-03-02 | 9/450 |
|
|
[考研]
|
glwshine 2026-03-02 | 5/250 |
|
|
[考研] 267求調(diào)劑 +6 | 釣魚佬as 2026-03-02 | 6/300 |
|
|
[考研] 080500材料科學(xué)與工程 +4 | 202114020319 2026-03-03 | 4/200 |
|
|
[考研] 材料類考研調(diào)劑 +6 | gemmgemm 2026-03-01 | 7/350 |
|
|
[考研] 材料化工調(diào)劑 +13 | 今夏不夏 2026-03-01 | 16/800 |
|
|
[考研] 272求調(diào)劑 +9 | 材紫有化 2026-02-28 | 9/450 |
|
|
[考研] 材料復(fù)試調(diào)劑 +5 | 學(xué)材料的點 2026-03-01 | 6/300 |
|
|
[考研] 一志愿中石油(華東)本科齊魯工業(yè)大學(xué) +3 | 石能偉 2026-03-02 | 3/150 |
|
|
[考研] 281求調(diào)劑 +5 | 2026計算機_誠心 2026-03-01 | 8/400 |
|
|
[考研] 材料類求調(diào)劑 +11 | wana_kiko 2026-02-28 | 14/700 |
|
|
[考研] 322求調(diào)劑 +3 | 熊境喆 2026-03-01 | 3/150 |
|
|
[考研]
|
15779376950 2026-03-01 | 5/250 |
|
|
[考研] 291分工科求調(diào)劑 +9 | science餓餓 2026-03-01 | 10/500 |
|