function KineticDataFit % Analysis of kinetic rate data by using the differential method % % Reaction of the type -- rA = kCA^order % order - reaction order % rA -- reaction rate vector % CA -- concentration vector for reactant A % t -- vector of reaction time % k- reacion rate constant % % Author: HUANG Huajiang % Copyright 2003 UNILAB Research Center, % East China University of Science and Technology, Shanghai, PRC % $Revision: 1.0 $ $Date: 2003/04/26 $ clear all clc % 动力学数据 t = [0 20 40 60 120 180 300]; CA = [10 8 6 5 3 2 1]; % 用最小二乘样条拟合法计算微分dCA/dt--使用不经过实验点的B样条插值函数 knots = 3; K = 3; % 三次B样条 sp = spap2(knots,K,t,CA) sp = spap2(newknt(sp),K,t,CA); pp = fnder(sp) % 计算B样条函数的导函数 dCAdt = fnval(pp,t) % 计算t处的导函数值 % 绘制图形 ti = linspace(t(1),t(end),200); CAi = fnval(sp,ti) plot(t,CA,'ro',ti,CAi,'b-') xlabel('t') ylabel('C_A') figure fnplt(pp) % dCAdti = fnval(pp,ti) % plot(ti,dCAdti,'-') xlabel('t') ylabel('dC/dt') % 线性拟合 rA = dCAdt; y = log(-rA); x = log(CA); p = polyfit(x,y,1); k = exp(p(2)) n = p(1) |