Could some one please help me spot how my array dimensions are not consistent?
function dcdt = diffcstrvalid2(t, C)k1 = 10;k2 = 5;CA0 = 0.3;CR0 = 0;CS0 = 0;tau = 0.3;%Rate Equations
rA = -k1 * C(1)-k2* C(1);rR = k1 * C(1);rS = k2* C(1);%differential equations
dcdt = [ (CA0-C(1))/tau -(-rA); (CR0-C(2))/tau+rR ; (CS0-C(3))/tau + rS];endinitCon = [0.3, 0, 0];% Residence times
t = [0, 0.3]; %s
%ODE SOLVER
[t2, C2] = ode45(@diffcstrvalid2, t, initCon, []);%PLOT CSTR
figure (3)plot(t2, C2 )grid onxlabel('tau [s]')ylabel('concentration [mol/L]')legend('c_A', 'c_R', 'c_S')crcao2 = C2(:,2)./0.3;cscao2 = C2(:,3)./0.3;xa2 = 1 - C2(:,1)/0.3;k1tau2 = 10.*t2;figure (4)plot( k1tau2, crcao2,'x', k1tau2, cscao2,'x', k1tau2, xa2, 'x')grid onxlabel('k1tau [s]')ylabel('C/CAO, XA' )legend('c_R', 'c_S', 'XA')
Best Answer