% Copyright (C) 2001, James B. Rawlings and John G. Ekerdt%% This program is free software; you can redistribute it and/or% modify it under the terms of the GNU General Public License as% published by the Free Software Foundation; either version 2, or (at% your option) any later version.%% This program is distributed in the hope that it will be useful, but% WITHOUT ANY WARRANTY; without even the implied warranty of% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU% General Public License for more details.%% You should have received a copy of the GNU General Public License% along with this program; see the file COPYING. If not, write to% the Free Software Foundation, 59 Temple Place - Suite 330, Boston,% MA 02111-1307, USA.% This program "schm2_error.m" generates error curves for the% reversible series problems as the reverse rate consant and% the second rate constant are varied. First-order reactions% Last edited 1/30/97.globalk1k_1k2k1=1;Initial=[1,0,0]';t=[0:.01:3]';t_tmp=t(2:length(t));k_1=100;k2=100;opts=odeset('AbsTol',sqrt(eps),'RelTol',sqrt(eps));[tsolver,solution]=ode15s(@rxrate,t,Initial,opts);alpha=(k1*k2)/(k_1+k2);c_Css=1-exp(-alpha*t_tmp);c_Cexact=solution(2:end,3);E=(c_Cexact-c_Css)./c_Cexact;EE=abs(E);error=log10(EE);%answer3 = [t_tmp error];% JBR, 2/22/98answer3=[t_tmpEE];k_1=1;k2=1000;opts=odeset('AbsTol',sqrt(eps),'RelTol',sqrt(eps));[tsolver,solution]=ode15s(@rxrate,t,Initial,opts);alpha=(k1*k2)/(k_1+k2);c_Css=1-exp(-alpha*t_tmp);c_Cexact=solution(2:end,3);E=(c_Cexact-c_Css)./c_Cexact;EE=abs(E);error=log10(EE);%answer3 = [answer3 error];% JBR, 2/22/98answer3=[answer3EE];k_1=1000;k2=1;opts=odeset('AbsTol',sqrt(eps),'RelTol',sqrt(eps));[tsolver,solution]=ode15s(@rxrate,t,Initial,opts);alpha=(k1*k2)/(k_1+k2);c_Css=1-exp(-alpha*t_tmp);c_Cexact=solution(2:end,3);E=(c_Cexact-c_Css)./c_Cexact;EE=abs(E);error=log10(EE);%answer3 = [answer3 error];% JBR, 2/22/98answer3=[answer3EE];k_1=1000;k2=1000;opts=odeset('AbsTol',sqrt(eps),'RelTol',sqrt(eps));[tsolver,solution]=ode15s(@rxrate,t,Initial,opts);alpha=(k1*k2)/(k_1+k2);c_Css=1-exp(-alpha*t_tmp);c_Cexact=solution(2:end,3);E=(c_Cexact-c_Css)./c_Cexact;EE=abs(E);error=log10(EE);%answer3 = [answer3 error];% JBR, 2/22/98answer3=[answer3EE];save-asciischm2_error.datanswer3;if(~strcmp(getenv('OMIT_PLOTS'),'true'))% PLOTTINGsemilogy(answer3(:,1),answer3(:,2:5));% TITLEend% PLOTTING