Help with syms ode solving
Show older comments
Hi there,
My ODE will solve when a1 = 0 but fails when a1 is not zero?
Any ideas most welcome!
function objective = myobjective(a0,a1)
syms Ca(z) Cb(z)
T=a0+a1.*z;
R= 8.3145;
Ca0 = 0.7;
k1 = 1.37.*10^10.*exp(-75000./(R.*T));
k2 = 1.19.*10^17.*exp(-125000./(R.*T));
ode1 = diff(Ca) == -4.*k1.*Ca;
ode2 = diff(Cb) == 4.*k1.*Ca - 4.*k2.*Cb;
odes = [ode1;ode2];
cond1 = Ca(0) == Ca0;
cond2 = Cb(0) == 0;
conds = [cond1; cond2];
[CaSol(z), CbSol(z)] = dsolve(odes,conds);
Cbfunction = matlabFunction(CbSol);
objective = 1./Cbfunction(2)
Thanks
Accepted Answer
More Answers (0)
Categories
Find more on Numeric Solvers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!