MATLAB: Is it posible to optimize kinetic parameter in following ordinary differential equation

kinetic parametrsoptimization

I have temperature along reactor length in dependence of tubular reactor volume (experimental data).
I need to optimize kinetic parameters (k1, k2, k3, k4, k5, k6 and k7) in (-rA1), (-rA2) and (-rA3).
rA1 = ((k1*k2 * Ca * (Cb ^ k3)) / (1 +k2 * Ca)). In reaction kinetic (-rA2) and (-rA3) i need to optimize and k4, k5, k6 and k7.
I know U, a, Ta, Fa, Fc, Fb, Fe, Fd, Fe, -deltaHr1, -deltaHr2, -deltaHr3, cpA, cpB, cpC, cpD and cpE.
d(T)/d(V) = (((((U * a * (Ta – T) ))) + ((-rA1) * (-deltaHr1) + (-rA2) * (-deltaHr2) + (-rC3) * (-deltaHr3)))) / (FA * cpA + FB * cpB + FC * cpC + FD * cpD + FE * cpE)
First
I load data T=f(V)
Then I wrote function: function [dTdV] = dTdV(C) where C are kinetic parameters k1= C(1), k2=C(2) etc. in which I defined all known variables and wrote the equation dT / dV = …
then i made script C=fminsearch(@dTdV,[0.1 0.1 0.1 0.001 0.12 0.20 0.01]);
and then I stucked.
Is it possible to solve this and in what way? Do I have to use Euler's method and how?
I tried to use Euler's method in the script, did I write well?
h=0.0001;
V=0:h:0.001177;
f=zeros(size(V));
T0=431.15;
f(1)=431.15;
n=numel(f);
for i=1:n-1
f=((U*a.......);
f(i+1)=f*h+f(i);
en
I got this error:
Index exceeds matrix dimensions.
Error in Script (line 64)
f(i+1)=f*h+f(i);
Thank You in advance.

Best Answer

I think that you would do better to use ode45 to solve your ODE, and use lsqcurvefit to optimize your parameters, as in this example.
But if you really want to do it your way, then I think the error is that you specify f instead of f(i) in this line:
f=((U*a.......);
% Should be
f(i) = ((U*a.......);
Alan Weiss
MATLAB mathematical toolbox documentation