资源描述
实验数据的数值积分问题用不同温度下固体铅的定压热容数据,求298K时的绝对熵。数据见下表:T, K)510152()253()5()7()CP. J K- mor1)()3052. SO7.0010.814 116.521.42.V310()1502CX)25029824.525.425.82C),226.5由热力学方法可知,绝对熵与定压热容有如下关系:CS =i TCpdTT 0 T采用MATLAB来计算,这里将最小二乘B样条拟合法和三次样条插值函数计算作比较,命令行程序如下:function Entropy_Intclear allclc% 读入数据T = 5. 10. 15. 20. 25. 30. 50. 70. 100. 150. 200. 250. 298.;Cp = 0.305 2.8 7.0 10.8 14.1 16.5 21.4 23.3 24.5 25.4 25.8 26.2 26.5; CpT = Cp./T;T = 0 T; CpT = 0 CpT;%用最小二乘B样条拟合法和三次样条插值函数计算knots = 3; K = 3;% 三次 B 样条sp = spapi(knots,K,T,CpT);cs = csapi(T,CpT); % 生成三次样条插值函数 cs% 绘制浓度拟合曲线Ti = linspace(T(1),T(end),299);CpT_B = fnval(sp,Ti);CpT_c = fnval(cs,Ti); plot(T,CpT,ro,Ti,CpT_B,b-,Ti,CpT_c,Bl-.) xlabel(T)ylabel(Cp/T)legend(实验值,B样条拟合,立方样条拟合)% 进行数值积分pp = fnint(cs);s = fnval(pp,T)T00.04330.87332.78205.33528.110410.907120.723628.259936.808546.920754.291960.088064.7233在解决本问题时,需首先要考虑积分下限,即T二0时的情形,因此时的C T为0/0。为 P此,可考虑先求出接近0K时的C数值。可有多种方法此数值,如通过TC图的样条插 PP值曲线读出,或采用回归拟合以及插值计算的方法。这里采用上述方法得到的数值是T二0.05,C = 0.003。由于本题的温度数据间隔不等,直接采用样条插值积分是一较好 P的方法。运用IMSL数学库中的样条插值CSINT和依据样条插值系数的积分CSITG,可以求得绝对熵,下面给出调用的主程序和计算结果。C To obtain the absolute entropy of solid lead at 298 K fromC the experimental data of the heat capacity at constant pressure CP ofC solid lead at various temperatures up to and including 298 KC by the cubic spline interpolant and integration from IMSL library.C the absolute entropy in CRC Handbook of Chemistry and Physics is 64.8 J K-1 mol-1.INTEGER NDATA, I, NINTV, NOUTPARAMETER (NDATA=14)REAL A, B, BREAK(NDATA), CSCOEF(4,NDATA), CSITG, ERROR,& EXACT, F, FDATA(NDATA), FI, FLOAT, VALUE, X, XDATA(NDATA)INTRINSIC FLOATEXTERNAL CSINT, CSITG, UMACHDATA (XDATA(I),I=1,NDATA)/0.05,5.,10.,15.,20.,25.,30.,50.,& 70.,100.,150.,200.,250.,298./DATA (FDATA(I),I=1,NDATA)/0.003,0.305,2.8,7.0,10.8,14.1,16.5,& 21.4,23.3,24.5,25.4,25.8,26.2,26.5/C Compute cubic spline interpolantDO 10 I=1,NDATAFDATA(I)=FDATA(I)/XDATA(I)10 CONTINUEC cubic spline interpolantCALL CSINT (NDATA, XDATA, FDATA, BREAK, CSCOEF) C cubic spline integrationA = 0.0B = 298.NINTV = NDATA - 1VALUE = CSITG(A,B,NINTV,BREAK,CSCOEF)EXACT = 64.8ERROR = EXACT - VALUE C Get output unit numberCALL UMACH (2, NOUT) C Print the resultWRITE (NOUT,99999) A, B, VALUE, EXACT, ERROR 99999 FORMAT ( On the closed interval (, F4.1, , F5.1,& ) we have :, /, 1X, Computed Integral = , F10.5, /,& 1X, Exact Integral = , F7.2, /, 1X, Error & , = , F10.5, /, /)ENDOutputOn the closed interval (0.0,298.0) we have : Computed Integral = 64.82892Exact Integral = 64.8 Error = -0.02892查阅CRC化学和物理手册,可得到固体铅298K时的绝对熵为64.8 J - K-1 - mol-1 ,与计算结果之间的差别很小。本题可用多种方法来解决,女如 Simpson数值积分法,或采用S =iln TCp (d In T )的形式,或先g用数据点拟合方程得回归参数,然后对回归方程进行积分(回归方程可用CpT = y, -+ + ,1 :1 + :1,也可在此基础上探索更好的回归方程形式)。
展开阅读全文