MATLAB Answers

Not enough input arguments. Error in UPVG7DEa18dp>kinetics12 (line 119) [Y]=ode45(@DifEq,t2,c0); Error in UPVG7DEa18dp (line 86) Cfit2 = kinetics12(theta,E,tv2);

1 view (last 30 days)
gezh
gezh on 15 Mar 2020
%temp=450 C data
t1 =[0
0.66667
1.33333
2
2.66667
3.33333
4
4.66667];
%concentration take H2 out
c1 =[0.0202 0.00678 0.01958 0.00931 0.13897 0.01081 0.17039 0.60315
0.02 0.00641 0.0191 0.0079 0.14299 0.00967 0.16753 0.6053
0.0202 0.00641 0.0194 0.0082 0.14403 0.01144 0.17055 0.59874
0.02041 0.0069 0.01971 0.00898 0.14004 0.01069 0.17271 0.59954
0.0207 0.00728 0.0199 0.00839 0.141 0.01039 0.18077 0.59016
0.02021 0.00735 0.01891 0.00964 0.13507 0.01058 0.18687 0.59064
0.0199 0.00742 0.0189 0.00993 0.13497 0.01117 0.19288 0.58495
0.02019 0.00767 0.01849 0.0106 0.13296 0.01185 0.19559 0.58367];
%temp=500 C data
t2 =[0
0.41667
1.08333
1.75
2.41667
3.08333
3.75
4.41667
5.08333
5.5
6.83333
8.16667
9.5
10.83333
12.5
15.33333
17.33333
18.66667];
%concentration take H2 out
c2 =[0.0556 0.00213 0.06413 0.00194 0.10049 0.00162 0.02279 0.72137
0.0423 0.00227 0.0551 0.00149 0.11101 0.00149 0.04028 0.71444
0.04699 0.00214 0.05639 0.00152 0.11197 0.00154 0.03752 0.71135
0.05031 0.00204 0.05741 0.00154 0.11202 0.00158 0.03562 0.70946
0.05242 0.00197 0.05853 0.00153 0.11105 0.00158 0.03418 0.70863
0.05367 0.00192 0.05967 0.00149 0.10995 0.00157 0.03321 0.70764
0.05483 0.00187 0.06092 0.00146 0.10786 0.00155 0.03214 0.70782
0.0549 0.00187 0.0611 0.00146 0.107 0.00158 0.03194 0.70854
0.05324 0.00182 0.05974 0.00149 0.10507 0.00157 0.03159 0.71486
0.051 0.00172 0.0578 0.00151 0.10299 0.00154 0.03062 0.72353
0.05168 0.00176 0.05947 0.0015 0.10295 0.00148 0.03005 0.72143
0.05422 0.00168 0.06363 0.00149 0.09824 0.0014 0.02923 0.71888
0.05368 0.00165 0.06367 0.00148 0.09736 0.00151 0.02867 0.7211
0.05409 0.00166 0.06359 0.00149 0.09729 0.00143 0.0298 0.71955
0.04983 0.00169 0.06234 0.00152 0.09886 0.00135 0.03048 0.7253
0.05299 0.00172 0.06229 0.00165 0.09479 0.00139 0.03004 0.72464
0.0552 0.00174 0.0649 0.0018 0.0942 0.00153 0.02961 0.7192
0.05424 0.00184 0.06205 0.00208 0.09647 0.00174 0.03061 0.71974];
theta0=[1;1;1;1;1;1;1;1;1;1;1;1];
E0=[10;10;10;10;10;10;10;10;10;10;10;10];
[theta]=lsqcurvefit(@kinetics12,theta0,t1,c1,t2,c2);
[E]=lsqcurvefit(@kinetics12,E0,t1,c1,t2,c2);
for k1 = 1:length(theta)
fprintf(1, '\t\tTheta(%d) = %8.5f\n', k1, theta(k1))
end
tv2 = linspace(min(t2), max(t2));
Cfit2 = kinetics12(theta,E,tv2);
tv1 = linspace(min(t1), max(t1));
Cfit1 = kinetics12(theta,E,tv1);
figure(2)
plot(t2, c2, 'p')
hold on
hlp2 = plot(tv2, Cfit2);
hold off
grid
xlabel('Time')
ylabel('Mole fraction')
legend(hlp2, 'C_1(t)', 'C_2(t)', 'C_3(t)', 'C_4(t)', 'C_5(t)','C_6(t)','C_7(t)','C_8(t)','Location','SW')
figure(1)
plot(t1, c1, 'p')
hold on
hlp1 = plot(tv1, Cfit1);
hold off
grid
xlabel('Time')
ylabel('Mole fraction')
legend(hlp1, 'C_1(t)', 'C_2(t)', 'C_3(t)', 'C_4(t)', 'C_5(t)','C_6(t)','C_7(t)','C_8(t)','Location','SW')
function C=kinetics12(theta,E,t1,t2)
c0=[0 0 0 1 0 0 0 0];
[Y]=ode45(@DifEq,t2,c0);
function Y = DifEq(t2,c2)
dc2dt2=zeros(8,1);
dc2dt2(1)= (theta(10)*exp(-E(10)/8.3145*(1/773 -1/723))).*c2(4)+(theta(2)*exp(-E(2)/8.3145*(1/773 -1/723))).*c2(5)+(theta(5)*exp(-E(5)/8.3145*(1/773 -1/723))).*c2(6)+1.47*(theta(7)*exp(-E(7)/8.3145*(1/773 -1/723))).*c2(7);
dc2dt2(2)= -(theta(12)*exp(-E(12)/8.3145*(1/773 -1/723))).*c2(2)- 2.2*(theta(6)*exp(-E(6)/8.3145*(1/773 -1/723))).*c2(2)+(theta(3)*exp(-E(3)/8.3145*(1/773 -1/723))).*c2(3)+(theta(10)*exp(-E(10)/8.3145*(1/773 -1/723))).*c2(4)+(theta(2)*exp(-E(2)/8.3145*(1/773 -1/723))).*c2(5)+1.47*(theta(7)*exp(-E(7)/8.3145*(1/773 -1/723))).*c2(7);
dc2dt2(3)= (theta(12)*exp(-E(12)/8.3145*(1/773 -1/723))).*c2(2)- (theta(3)*exp(-E(3)/8.3145*(1/773 -1/723))).*c2(3);
dc2dt2(4)= -(theta(11)*exp(-E(11)/8.3145*(1/773 -1/723))).*c2(4)-(theta(10)*exp(-E(10)/8.3145*(1/773 -1/723))).*c2(4)-1.33*(theta(4)*exp(-E(4)/8.3145*(1/773 -1/723))).*c2(4)-2.57*(theta(9)*exp(-E(9)/8.3145*(1/773 -1/723))).*c2(4)+(theta(1)*exp(-E(1)/8.3145*(1/773 -1/723))).*c2(5)+1.33*(theta(5)*exp(-E(5)/8.3145*(1/773 -1/723))).*c2(6);
dc2dt2(5)= (theta(11)*exp(-E(11)/8.3145*(1/773 -1/723))).*c2(4)-(theta(1)*exp(-E(1)/8.3145*(1/773 -1/723))).*c2(5)-(theta(2)*exp(-E(2)/8.3145*(1/773 -1/723))).*c2(5);
dc2dt2(6)=1.33*(theta(4)*exp(-E(4)/8.3145*(1/773 -1/723))).*c2(4)-(theta(5)*exp(-E(5)/8.3145*(1/773 -1/723))).*c2(6)-1.93*(theta(8)*exp(-E(8)/8.3145*(1/773 -1/723))).*c2(8);
dc2dt2(7)=2.2*(theta(6)*exp(-E(6)/8.3145*(1/773 -1/723))).*c2(2)-(theta(7)*exp(-E(7)/8.3145*(1/773 -1/723))).*c2(7);
dc2dt2(8)=2.57*(theta(9)*exp(-E(9)/8.3145*(1/773 -1/723))).*c2(4)+1.93*(theta(8)*exp(-E(8)/8.3145*(1/773 -1/723))).*c2(6);
Y=dc2dt2;
end
[X] = ode45(@DifEq1,t1,c0);
function X = DifEq1(t1,c1)
dc1dt1=zeros(8,1);
dc1dt1(1)= theta(10).*c1(4)+theta(2).*c1(5)+theta(5).*c1(6)+1.47*theta(7).*c1(7);
dc1dt1(2)= -theta(12).*c1(2)- 2.2*theta(6).*c1(2)+theta(3).*c1(3)+theta(10).*c1(4)+theta(2).*c1(5)+1.47*theta(7).*c1(7);
dc1dt1(3)= theta(12).*c1(2)- theta(3).*c1(3);
dc1dt1(4)= -theta(11).*c1(4)-theta(10).*c1(4)-1.33*theta(4).*c1(4)-2.57*theta(9).*c1(4)+theta(1).*c1(5)+1.33*theta(5).*c1(6);
dc1dt1(5)= theta(11).*c1(4)-theta(1).*c1(5)-theta(2).*c1(5);
dc1dt1(6)=1.33*theta(4).*c1(4)-theta(5).*c1(6)-1.93*theta(8).*c1(8);
dc1dt1(7)=2.2*theta(6).*c1(2)-theta(7).*c1(7);
dc1dt1(8)=2.57*theta(9).*c1(4)+1.93*theta(8).*c1(6);
X = dc1dt1;
end
C = X | Y;
end

  0 Comments

Sign in to comment.

Answers (0)

Sign in to answer this question.


|