| 5 | 1/1 | 返回列表 |
| 查看: 1709 | 回復(fù): 6 | ||||
| 當(dāng)前只顯示滿足指定條件的回帖,點(diǎn)擊這里查看本話題的所有回帖 | ||||
[求助]
如何使用1stOpt進(jìn)行三自變量三因變量的非線性擬合 已有2人參與
|
||||
|
正在學(xué)習(xí)使用1stOpt,見到的示例都是只有單個(gè)因變量的非線性擬合。想要使用1stopt對三元液液相平衡的NRTL熱力學(xué)數(shù)據(jù)進(jìn)行擬合,由于出現(xiàn)三個(gè)因變量,不太確定如何編程。編寫的程序如下,如不使用sharedmodel,可以得到結(jié)果,但不理想;如使用sharedmodel,軟件無法計(jì)算。還望前輩可以給予一定指導(dǎo)。 Title "NRTL simulation"; //sharedmodel; Parameters alpha[0,1],tau12,tau13,tau21,tau23,tau31,tau32; Variables x1,x2,x3,y1,y2,y3; ConstStr F12=exp(-alpha*tau12); ConstStr F13=exp(-alpha*tau13); ConstStr F21=exp(-alpha*tau21); ConstStr F23=exp(-alpha*tau23); ConstStr F31=exp(-alpha*tau31); ConstStr F32=exp(-alpha*tau32); ConstStr lngammax1=(x1*0*1+x2*tau21*F21+x3*tau31*F31)/(x1*1+x2*F21+x3*F31)+ (x1*1/(x1*1+x2*F21+x3*F31)*(0-(x1*0*1+x2*tau21*F21+x3*tau31*F31)/(x1*1+x2*F21+x3*F31)))+ (x2*F12/(x1*F12+x2*1+x3*F32)*(tau12-(x1*tau12*F12+x2*0*1+x3*tau32*F32)/(x1*F12+x2*0+x3*F32)))+ (x3*F13/(x1*F12+x2*F23+x3*1)*(tau13-(x1*tau13*F13+x2*tau23*F23+x3*0*1)/(x1*F13+x2*F23+x3*1))); ConstStr lngammax2=(x1*tau12*F12+x2*0*1+x3*tau32*F32)/(x1*F12+x2*0+x3*F32)+ (x1*F21/(x1*1+x2*F21+x3*F31)*(tau21-(x1*0*1+x2*tau21*F21+x3*tau31*F31)/(x1*1+x2*F21+x3*F31)))+ (x2*1/(x1*F12+x2*1+x3*F32)*(0-(x1*tau12*F12+x2*0*1+x3*tau32*F32)/(x1*F12+x2*0+x3*F32)))+ (x3*F23/(x1*F12+x2*F23+x3*1)*(tau23-(x1*tau13*F13+x2*tau23*F23+x3*0*1)/(x1*F13+x2*F23+x3*1))); ConstStr lngammax3=(x1*tau13*F13+x2*tau23*F23+x3*0*1)/(x1*F13+x2*F23+x3*1)+ (x1*F31/(x1*1+x2*F21+x3*F31)*(tau31-(x1*0*1+x2*tau21*F21+x3*tau31*F31)/(x1*1+x2*F21+x3*F31)))+ (x2*F32/(x1*F12+x2*1+x3*F32)*(tau32-(x1*tau12*F12+x2*0*1+x3*tau32*F32)/(x1*F12+x2*0+x3*F32)))+ (x3*1/(x1*F12+x2*F23+x3*1)*(0-(x1*tau13*F13+x2*tau23*F23+x3*0*1)/(x1*F13+x2*F23+x3*1))); ConstStr gammax1=exp(lngammax1); ConstStr gammax2=exp(lngammax2); ConstStr gammax3=exp(lngammax3); ConstStr lngammay1=(y1*0*1+y2*tau21*F21+y3*tau31*F31)/(y1*1+y2*F21+y3*F31)+ (y1*1/(y1*1+y2*F21+y3*F31)*(0-(y1*0*1+y2*tau21*F21+y3*tau31*F31)/(y1*1+y2*F21+y3*F31)))+ (y2*F12/(y1*F12+y2*1+y3*F32)*(tau12-(y1*tau12*F12+y2*0*1+y3*tau32*F32)/(y1*F12+y2*0+y3*F32)))+ (y3*F13/(y1*F12+y2*F23+y3*1)*(tau13-(y1*tau13*F13+y2*tau23*F23+y3*0*1)/(y1*F13+y2*F23+y3*1))); ConstStr lngammay2=(y1*tau12*F12+y2*0*1+y3*tau32*F32)/(y1*F12+y2*0+y3*F32)+ (y1*F21/(y1*1+y2*F21+y3*F31)*(tau21-(y1*0*1+y2*tau21*F21+y3*tau31*F31)/(y1*1+y2*F21+y3*F31)))+ (y2*1/(y1*F12+y2*1+y3*F32)*(0-(y1*tau12*F12+y2*0*1+y3*tau32*F32)/(y1*F12+y2*0+y3*F32)))+ (y3*F23/(y1*F12+y2*F23+y3*1)*(tau23-(y1*tau13*F13+y2*tau23*F23+y3*0*1)/(y1*F13+y2*F23+y3*1))); ConstStr lngammay3=(y1*tau13*F13+y2*tau23*F23+y3*0*1)/(y1*F13+y2*F23+y3*1)+ (y1*F31/(y1*1+y2*F21+y3*F31)*(tau31-(y1*0*1+y2*tau21*F21+y3*tau31*F31)/(y1*1+y2*F21+y3*F31)))+ (y2*F32/(y1*F12+y2*1+y3*F32)*(tau32-(y1*tau12*F12+y2*0*1+y3*tau32*F32)/(y1*F12+y2*0+y3*F32)))+ (y3*1/(y1*F12+y2*F23+y3*1)*(0-(y1*tau13*F13+y2*tau23*F23+y3*0*1)/(y1*F13+y2*F23+y3*1))); ConstStr gammay1=exp(lngammay1); ConstStr gammay2=exp(lngammay2); ConstStr gammay3=exp(lngammay3); Function y1=x1*gammax1/gammay1; y2=x2*gammax2/gammay2; y3=x3*gammax3/gammay3; Data; 0.9561 0.0289 0.0150 0.0010 0.0011 0.9979 0.9101 0.0739 0.0160 0.0013 0.0028 0.9959 0.7982 0.1675 0.0343 0.0010 0.0071 0.9919 0.6980 0.2558 0.0462 0.0026 0.0164 0.9810 0.6461 0.2941 0.0598 0.0018 0.0253 0.9729 0.5686 0.3488 0.0826 0.0011 0.0404 0.9585 0.5194 0.3921 0.0885 0.0037 0.0525 0.9438 0.4919 0.4101 0.0980 0.0045 0.0583 0.9372 0.4664 0.4319 0.1017 0.0079 0.0688 0.9233 0.4497 0.4410 0.1093 0.0111 0.0736 0.9153 0.4374 0.4498 0.1128 0.0125 0.0884 0.8991 0.4189 0.4515 0.1296 0.0186 0.0942 0.8872 |
鐵桿木蟲 (職業(yè)作家)
| sharedmodel;可以實(shí)現(xiàn)多因子參數(shù)共享擬合,1.5的估計(jì)不行。 |
|
將代碼進(jìn)行了一定處理,仍然提示Fatal: Line too long (more than 1023 characters),Compile failed, check your program codes please!。是因?yàn)樽詈蟮墓竭^于復(fù)雜嗎? Title "NRTL simulation"; sharedmodel; Parameters alpha[0,1],t12,t13,t21,t23,t31,t32; Variables x1,x2,x3,y1,y2,y3; ConstStr G12=exp(-alpha*t12), G13=exp(-alpha*t13), G21=exp(-alpha*t21), G23=exp(-alpha*t23), G31=exp(-alpha*t31), G32=exp(-alpha*t32), a=(x2*t21*G21+x3*t31*G31)/(x1+x2*G21+x3*G31), b=(x1*t12*G12+x3*t32*G32)/(x1*G12+x2+x3*G32), c=(x1*t13*G13+x2*t23*G23)/(x1*G13+x2*G23+x3), d=x1/(x1+x2*G21+x3*G31), e=x2/(x1*G12+x2+x3*G32), f=x3/(x1*G13+x2*G23+x3), j=(y2*t21*G21+y3*t31*G31)/(y1+y2*G21+y3*G31), k=(y1*t12*G12+y3*t32*G32)/(y1*G12+y2+y3*G32), l=(y1*t13*G13+y2*t23*G23)/(y1*G13+y2*G23+y3), m=y1/(y1+y2*G21+y3*G31), n=y2/(y1*G12+y2+y3*G32), o=y3/(y1*G13+y2*G23+y3); Conststr lngammax1=a-d*a+e*G12*(t12-b)+f*G13*(t13-c), lngammax2=b+d*G12*(t21-a)-e*b+f*G23*(t23-c), lngammax3=c+d*G31*(t31-a)+e*G32*(t32-b)-f*c, lngammay1=j-m*j+n*G12*(t12-k)+o*G13*(t13-l), lngammay2=k+m*G12*(t21-j)-n*k+o*G23*(t23-l), lngammay3=l+m*G31*(t31-j)+n*G32*(t32-k)-o*l; Conststr gammax1=exp(lngammax1), gammax2=exp(lngammax2), gammax3=exp(lngammax3), gammay1=exp(lngammay1), gammay2=exp(lngammay2), gammay3=exp(lngammay3); Function y1=x1*gammax1/gammay1; y2=x2*gammax2/gammay2; y3=x3*gammax3/gammay3; Data; 0.9561 0.0289 0.0150 0.0010 0.0011 0.9979 0.9101 0.0739 0.0160 0.0013 0.0028 0.9959 0.7982 0.1675 0.0343 0.0010 0.0071 0.9919 0.6980 0.2558 0.0462 0.0026 0.0164 0.9810 0.6461 0.2941 0.0598 0.0018 0.0253 0.9729 0.5686 0.3488 0.0826 0.0011 0.0404 0.9585 0.5194 0.3921 0.0885 0.0037 0.0525 0.9438 0.4919 0.4101 0.0980 0.0045 0.0583 0.9372 0.4664 0.4319 0.1017 0.0079 0.0688 0.9233 0.4497 0.4410 0.1093 0.0111 0.0736 0.9153 0.4374 0.4498 0.1128 0.0125 0.0884 0.8991 0.4189 0.4515 0.1296 0.0186 0.0942 0.8872 |
專家顧問 (正式寫手)
![]() |
專家經(jīng)驗(yàn): +65 |
|
1.5版本太低了,即使能計(jì)算共享參數(shù)擬合,你的代碼有點(diǎn)復(fù)雜,軟件功能不夠。 需要正版高版本軟件來計(jì)算。 [ 發(fā)自手機(jī)版 http://www.gaoyang168.com/3g ] |

| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 求調(diào)劑求調(diào)劑 +7 | 121. 2026-04-02 | 7/350 |
|
|---|---|---|---|---|
|
[考研] 342求調(diào)劑 +14 | Mary Keen 2026-03-28 | 15/750 |
|
|
[考研] 315分 085602 求調(diào)劑 +5 | 26考研上岸版26 2026-04-02 | 5/250 |
|
|
[考研] 301求調(diào)劑 +4 | 細(xì)胞相關(guān)蛋白 2026-04-02 | 8/400 |
|
|
[考研] 261求B區(qū)調(diào)劑 +5 | 明仔· 2026-04-01 | 7/350 |
|
|
[考研] 計(jì)算機(jī)265跨調(diào)環(huán)境 +5 | Yumeng_6 2026-03-27 | 5/250 |
|
|
[考研] 一志愿346上海大學(xué)生物學(xué) +3 | 上海大學(xué)346調(diào)劑 2026-04-01 | 3/150 |
|
|
[考研] 一志愿北交大材料工程,總分358 +4 | cs0106 2026-04-01 | 4/200 |
|
|
[考博] 26年申博 +3 | staryer 2026-03-30 | 4/200 |
|
|
[考研] 一志愿西安交大材料學(xué)碩(英一數(shù)二)347,求調(diào)劑到高分子/材料相關(guān)專業(yè) +7 | zju51 2026-03-31 | 9/450 |
|
|
[考研] 286求調(diào)劑 +5 | lim0922 2026-03-26 | 5/250 |
|
|
[考研] 08工科,295,接受跨專業(yè)調(diào)劑 +6 | lmnlzy 2026-03-31 | 6/300 |
|
|
[考研] 301求調(diào)劑 +8 | axibli 2026-04-01 | 8/400 |
|
|
[考研] 土木304求調(diào)劑 +5 | 頂級擦擦 2026-03-31 | 5/250 |
|
|
[考研] 求調(diào)劑:085600材料與化工,考材科基,總分319 +17 | 678lucky 2026-03-31 | 21/1050 |
|
|
[考研] 一志愿a區(qū)211,085601-307分求調(diào)劑 +10 | 黨嘉豪 2026-03-31 | 23/1150 |
|
|
[考研] 277跪求調(diào)劑 +8 | 1915668 2026-03-27 | 13/650 |
|
|
[考研] 332求92調(diào)劑 +8 | 蕉蕉123 2026-03-28 | 8/400 |
|
|
[考研] 081200-11408-276學(xué)碩求調(diào)劑 +6 | 崔wj 2026-03-26 | 6/300 |
|
|
[考研] 復(fù)試調(diào)劑 +3 | raojunqi0129 2026-03-28 | 3/150 |
|