OK, you have 2 coupled ODEs. If I expand the D/Dt(log(V(t))) to 1/V(t)*D/Dt(V(t) I'd get something like this:
function dVdtdcadt = odeperhaps(Vca,t)
k = 12;
V = Vca(1);
ca = Vca(2);
dcadt = k*ca^2;
dVdt = -k*ca*V - dcadt*V/ca;
dVdtdcadt = [dVdt;dcadt];
end
These coupled ODEs you then integrate together. You might want to set the ode-options that ensure the solutions are kept positive - check the help and documentation for ode45 and odeset, it should be the 'NonNegative' field that should be used. That ought to make the V and ca in the denominators safe...
Perhaps I misstyped something.
HTH
2 Comments
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/659063-ode-solving-lack-of-span-inputs#comment_1155253
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/659063-ode-solving-lack-of-span-inputs#comment_1155253
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/659063-ode-solving-lack-of-span-inputs#comment_1155283
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/659063-ode-solving-lack-of-span-inputs#comment_1155283
Sign in to comment.