[未答复] 跪求啊 代数方程参数拟合问题 自己求出来的置信区间特别大特别大 麻烦各路大神看看哪错了 跪求 感谢

[复制链接]
化工坑中人 发表于 4 天前
10 财富积分

本帖最后由 化工坑中人 于 2021-1-14 16:23 编辑

两个代数方程求参数,不知道为什么求出来的置信区间特别大,麻烦大神帮忙看看,感激不尽
function syg0113
clear all
clc
T=1273;
R=8.314;
PCH4=[0.0144584760273973,0.187274700529598,0.476532221607080,1.07921618298725,1.85188855353433];
PCO=[10.2971835311751,10.1252435529014,9.65139611815989,9.22054097686178,8.43011386365698];
PCO2=[4.14683402019478,4.19526340149898,4.46238042531351,4.46250138023293,4.70070473075001];
PH2=[47.6234714345784,47.3018620812494,46.9496131433845,45.6592510369179,44.2429875854504];
PH2O=[24.7845765106271,25.0075746088906,25.1947693264545,26.1412318829182,27.1165981186670];
KCO=8.23e-7*exp(70650/R/T);
KH2=6.12e-11*exp(82900/R/T);
KCH4=6.65e-6*exp(38180/R/T);
KH2O=1.77e5*exp(-88680/R/T);
K1=10266.76*exp(-26830/T+30.114);
K2=exp(4400/T-4.063);
K3=K1*K2;
DEN=1+KCO*PCO+KH2*PH2+KCH4*PCH4+KH2O*PH2O./PH2;
x1=(PCH4.*PH2O-PH2.^3.*PCO./K1)./PH2.^2.5./DEN.^2;
x2=(PCO.*PH2O-PH2.*PCO./K2)./DEN.^2./PH2;
x3=(PCH4.*PH2O.^2-PH2.^4.*PCO2./K3)./DEN.^2./PH2.^3.5;
y1=[0.0020    0.0963    1.0882    2.1391    3.0805  ];
y2=[0.0071    0.5481    1.2768    1.9309    2.4807  ];

lb=[0 0 0]; ub=[+inf +inf +inf]; k0=[100000 10 100000];
[k,resnorm,resid,exitflag,output,lambda,jacobian] = ...
    lsqnonlin(@ObjFun0113,k0,lb,ub,[],x1,x2,x3,y1,y2);
ci = nlparci(k,resid,jacobian);
fprintf('\tk1 = %.4f ± %.4f\n',k(1),ci(1,2)-k(1))
fprintf('\tk2 = %.4f ± %.4f\n',k(2),ci(2,2)-k(2))
fprintf('\tk3 = %.4f ± %.4f\n',k(3),ci(3,2)-k(3))
%fprintf('\tk4 = %.4f ± %.4f\n',k(4),ci(4,2)-k(4))
%fprintf('\tk5 = %.4f ± %.4f\n',k(5),ci(5,2)-k(5))
fprintf('  The sum of the squares is: %.1e\n\n',resnorm)
% ------------------------------------------------------------------
function f = ObjFun0113(k,x1,x2,x3,y1,y2)
f1 = y1- k(1)*x1-k(3)*x3;
f2 = y2-k(1)*x1+k(2)*x2;
f=[f1;f2];
运行结果:
k1 = 442239.7387 ± 115563.1359
    k2 = 11.0121 ± 15.4484
    k3 = 202739.7861 ± 247914.6556
  The sum of the squares is: 5.1e-01


您需要登录后才可以回帖 登录 | 注册

本版积分规则

热门教程
站长推荐
快速回复 返回顶部 返回列表