| 3 | 1/1 | 返回列表 |
| 查看: 591 | 回復(fù): 2 | ||
[交流]
【求助】修改程序
|
|
目前下面的程序能得到r=kPA^ n PB^ m中的k、n、m值,但是我想把程序修改成能直接求r=k0e(-Ea/RT)PA^nPB^m,中的k0、Ea、n和m。應(yīng)該如何修改程序,求大神賜教,不甚感激。 數(shù)據(jù)如下: T=310+273.15K時(shí) PA0 = [3.7449 3.7500 3.7548 3.7568]; PB0 = [0.0807 0.0835 0.0861 0.0871]; r = [0.0019 0.0022 0.0024 0.0025]; T=330+273.15K時(shí) PA0 = [3.7138 3.7215 3.7448 3.7572]; PB0 = [0.04 0.0458 0.0618 0.071]; r = [0.0041 0.0097 0.0109 0.0111]; Ps:R是常數(shù)R=8.3145 r=kPA^nPB^m的程序 function KineticsEst3 % 動(dòng)力學(xué)參數(shù)辨識(shí): 用微分法進(jìn)行反應(yīng)速率分析得到速率常數(shù)k和反應(yīng)級(jí)數(shù)n % Reaction of the type -- rate = kCA^order % order - reaction order % rate -- reaction rate vector % CA -- concentration vector for reactant A % T -- vector of reaction time % N -- number of data points % k- reacion rate constant clear all clc global negr0m PA0 PB0 PA0 = [3.7449 3.7500 3.7548 3.7568]; PB0 = [0.0807 0.0835 0.0861 0.0871]; % negr0m = [0.5 0.63 0.83 1.0 1.28 0.33 0.8 1.5 2.21 3.33]; % Problems ... negr0m = [0.0019 0.0022 0.0024 0.0025]; % 用多變量線性回歸方法估計(jì)動(dòng)力學(xué)參數(shù) y = log(negr0m); x1 = log(PA0); x2 = log(PB0); y = y'; X = [ones(size(y)) x1' x2']; [b,bint] = regress(y,X,0.1); k = exp(b(1)) n = b(2) m = b(3) % 用多變量非線性回歸方法(以線性回歸的結(jié)果作為非線性回歸的初值) beta0 = [k n m]; lb = [0 0 0]; ub = [1 3 3]; [beta,resnorm,resid,exitflag,output,lambda,jacobian] = ... lsqnonlin(@ObjFunc,beta0,lb,ub); ci = nlparci(beta,resid,jacobian) % 殘差關(guān)于擬合值的殘差圖 negrA0c = Rate(beta,PA0,PB0); plot(negrA0c,resid,'*') xlabel('反應(yīng)速率擬合值, torr s^-^1') ylabel('殘差R, torr s^-^1') refline(0,0) % 參數(shù)辨識(shí)結(jié)果 fprintf('Estimated Parameters:\n') fprintf('\tk = %.4f ± %.4f\n',beta(1),ci(1,2)-beta(1)) fprintf('\tn = %.2f ± %.2f\n',beta(2),ci(2,2)-beta(2)) fprintf('\tm = %.2f ± %.2f\n',beta(3),ci(3,2)-beta(3)) fprintf('\tThe sum of the squares is: %.1e\n\n',resnorm) % ------------------------------------------------------------------ function f = ObjFunc(beta) global negr0m PA0 PB0 f = negr0m - Rate(beta,PA0,PB0); % ------------------------------------------------------------------ function negrA = Rate(beta,PA,PB) negrA = beta(1)*PA.^beta(2).*PB.^beta(3); % k=beta(1),n=beta(2),m=beta(3); |
» 搶金幣啦!回帖就可以得到:
+1/643
+5/160
+2/100
+1/86
+1/85
+1/84
+1/39
+1/33
+1/31
+1/31
+1/30
+1/16
+1/13
+2/12
+1/11
+1/6
+1/6
+1/4
+1/1
+1/1
|
我把你的程序修改了一下,能運(yùn)行了,但是需要增加一組實(shí)驗(yàn)數(shù)據(jù),如果不懂,請給我短消息~ function KineticsEst3_1 % 動(dòng)力學(xué)參數(shù)辨識(shí): 用微分法進(jìn)行反應(yīng)速率分析得到速率常數(shù)k和反應(yīng)級(jí)數(shù)n % Reaction of the type -- rate = kCA^order % order - reaction order % rate -- reaction rate vector % CA -- concentration vector for reactant A % T -- vector of reaction time % N -- number of data points % k- reacion rate constant clear all clc global negr0m PA0 PB0 RT PA0 = [3.7449 3.7500 3.7548 3.7568 3.7588 ]; PB0 = [0.0807 0.0835 0.0861 0.0871 0.0891]; RT=8.3*(310+273)*ones(1,5); % negr0m = [0.5 0.63 0.83 1.0 1.28 0.33 0.8 1.5 2.21 3.33]; % Problems ... negr0m = [0.0019 0.0022 0.0024 0.0025 0.0028]; % 用多變量線性回歸方法估計(jì)動(dòng)力學(xué)參數(shù) y = log(negr0m); x1 = log(PA0); x2 = log(PB0); x3 =log(8.3*(310+273))*ones(1,5); y = y'; X = [ones(size(y)) x1' x2' x3']; [b,bint] = regress(y,X,0.1); k0 = exp(b(1)) n = b(2) m = b(3) Ea = b(4) % 用多變量非線性回歸方法(以線性回歸的結(jié)果作為非線性回歸的初值) beta0 = [k0 n m Ea]; lb = [0 0 0 -10]; ub = [1 3 3 10]; [beta,resnorm,resid,exitflag,output,lambda,jacobian] = ... lsqnonlin(@ObjFunc,beta0,lb,ub); ci = nlparci(beta,resid,jacobian) % 殘差關(guān)于擬合值的殘差圖 negrA0c = Rate(beta,PA0,PB0,RT); plot(negrA0c,resid,'*') xlabel('反應(yīng)速率擬合值, torr s^-^1') ylabel('殘差R, torr s^-^1') refline(0,0) % 參數(shù)辨識(shí)結(jié)果 fprintf('Estimated Parameters:\n') fprintf('\tk = %.4f ± %.4f\n',beta(1),ci(1,2)-beta(1)) fprintf('\tn = %.2f ± %.2f\n',beta(2),ci(2,2)-beta(2)) fprintf('\tm = %.2f ± %.2f\n',beta(3),ci(3,2)-beta(3)) fprintf('\tEa = %.2f ± %.2f\n',beta(4),ci(4,2)-beta(4)) fprintf('\tThe sum of the squares is: %.1e\n\n',resnorm) %------------------------------------------------------------------ function f = ObjFunc(beta) global negr0m PA0 PB0 RT f = negr0m - Rate(beta,PA0,PB0,RT); % ------------------------------------------------------------------ function negrA = Rate(beta,PA,PB,RT) negrA = beta(1)*PA.^beta(2).*PB.^beta(3).*exp(beta(4)./RT); % k=beta(1),n=beta(2),m=beta(3);3.75883.7588 |
|
clear all clc global negr0m PA0 PB0 RT PA0 = [3.7377 3.7449 3.7500 3.7548 3.7568 3.5690 3.5859 3.5970 3.6046 3.6119 3.6161]; PB0 = [0.0769 0.0807 0.0835 0.0861 0.0871 0.0389 0.0468 0.0520 0.0554 0.0581 0.0601]; RT1=8.3145*(310+273.15)*ones(1,5); RT2=8.3145*(330+273.15)*ones(1,6); RT=[RT1 RT2]; % negr0m = [0.5 0.63 0.83 1.0 1.28 0.33 0.8 1.5 2.21 3.33]; % Problems ... negr0m = [0.0023 0.0024 0.0024 0.0025 0.0025 0.0040 0.0042 0.0044 0.0046 0.0048 0.0049]; % 用多變量線性回歸方法估計(jì)動(dòng)力學(xué)參數(shù) y = log(negr0m); x1 = log(PA0); x2 = log(PB0); x3 =log(RT); y = y'; X = [ones(size(y)) x1' x2' x3']; [b,bint] = regress(y,X,0.1); k0 = exp(b(1)) n = b(2) m = b(3) Ea = b(4) % 用多變量非線性回歸方法(以線性回歸的結(jié)果作為非線性回歸的初值) beta0 = [k0 n m Ea]; lb = [0 0 0 -10]; ub = [1 3 3 10]; [beta,resnorm,resid,exitflag,output,lambda,jacobian] = ... lsqnonlin(@ObjFunc,beta0,lb,ub); ci = nlparci(beta,resid,jacobian) % 殘差關(guān)于擬合值的殘差圖 negrA0c = Rate(beta,PA0,PB0,RT); plot(negrA0c,resid,'*') xlabel('反應(yīng)速率擬合值, torr s^-^1') ylabel('殘差R, torr s^-^1') refline(0,0) % 參數(shù)辨識(shí)結(jié)果 fprintf('Estimated Parameters:\n') fprintf('\tk = %.4f ± %.4f\n',beta(1),ci(1,2)-beta(1)) fprintf('\tn = %.2f ± %.2f\n',beta(2),ci(2,2)-beta(2)) fprintf('\tm = %.2f ± %.2f\n',beta(3),ci(3,2)-beta(3)) fprintf('\tEa = %.2f ± %.2f\n',beta(4),ci(4,2)-beta(4)) fprintf('\tThe sum of the squares is: %.1e\n\n',resnorm) %------------------------------------------------------------------ function f = ObjFunc(beta) global negr0m PA0 PB0 RT f = negr0m - Rate(beta,PA0,PB0,RT); % ------------------------------------------------------------------ function negrA = Rate(beta,PA,PB,RT) negrA = beta(1)*PA.^beta(2).*PB.^beta(3).*exp(-beta(4)./RT); % k=beta(1),n=beta(2),m=beta(3);Ea=beta(4); 為什么最終的結(jié)果和 lb = [0 0 0 -10]; ub = [1 3 3 10]; 有很大關(guān)系,該如何解決 [ Last edited by 小扶搖 on 2010-12-15 at 13:35 ] |
| 3 | 1/1 | 返回列表 |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|
百度網(wǎng)盤 |
360云盤 |
千易網(wǎng)盤 |
華為網(wǎng)盤
在新窗口頁面中打開自己喜歡的網(wǎng)盤網(wǎng)站,將文件上傳后,然后將下載鏈接復(fù)制到帖子內(nèi)容中就可以了。 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 一志愿吉林大學(xué)材料學(xué)碩321求調(diào)劑 +11 | Ymlll 2026-03-18 | 15/750 |
|
|---|---|---|---|---|
|
[考研] 289求調(diào)劑 +3 | 懷瑾握瑜l 2026-03-20 | 3/150 |
|
|
[考研] 279分求調(diào)劑 一志愿211 +9 | chaojifeixia 2026-03-19 | 10/500 |
|
|
[考研] 招收調(diào)劑碩士 +4 | lidianxing 2026-03-19 | 12/600 |
|
|
[考研] 一志愿 南京航空航天大學(xué)大學(xué) ,080500材料科學(xué)與工程學(xué)碩 +4 | @taotao 2026-03-20 | 4/200 |
|
|
[考研] 081700化工學(xué)碩調(diào)劑 +3 | 【1】 2026-03-16 | 3/150 |
|
|
[考研] 復(fù)試調(diào)劑 +4 | z1z2z3879 2026-03-14 | 6/300 |
|
|
[考研] 0703化學(xué)調(diào)劑 +4 | 18889395102 2026-03-18 | 4/200 |
|
|
[考研] 0703化學(xué)調(diào)劑,求各位老師收留 +10 | 秋有木北 2026-03-14 | 10/500 |
|
|
[考研] 344求調(diào)劑 +6 | knight344 2026-03-16 | 7/350 |
|
|
[考研] 085601專碩,總分342求調(diào)劑,地區(qū)不限 +5 | share_joy 2026-03-16 | 5/250 |
|
|
[考研] 311求調(diào)劑 +6 | 26研0 2026-03-15 | 6/300 |
|
|
[考研] 0703化學(xué)調(diào)劑 +3 | 妮妮ninicgb 2026-03-17 | 3/150 |
|
|
[考研] 293求調(diào)劑 +11 | zjl的號(hào) 2026-03-16 | 16/800 |
|
|
[考研] 326求調(diào)劑 +5 | 上岸的小葡 2026-03-15 | 6/300 |
|
|
[考研] 考研化學(xué)學(xué)碩調(diào)劑,一志愿985 +4 | 張vvvv 2026-03-15 | 6/300 |
|
|
[考研] 308求調(diào)劑 +4 | 是Lupa啊 2026-03-16 | 4/200 |
|
|
[考研] 326求調(diào)劑 +3 | mlpqaz03 2026-03-15 | 3/150 |
|
|
[考研] 080500,材料學(xué)碩302分求調(diào)劑學(xué)校 +4 | 初識(shí)可樂 2026-03-14 | 5/250 |
|
|
[考研] 一志愿哈工大材料324分求調(diào)劑 +5 | 閆旭東 2026-03-14 | 5/250 |
|