Hey guys,
I need to estimate the reaction rate from given data in excel. To answer this I set up the differential equations and appointed the given data (for the sake of convenience I briefly reduced the data set here). My first thought was that the most simple way to estimate the rate was to use ODE45, but since it doesn't works I assume I made a mistake somewhere.
This was the code I made:
function [dxdt] = data(t)A = [0.98 0.97 0.95 0.92 0.90]';B = [0.99 0.97 0.95 0.93 0.90]';C = [0.01 0.03 0.07 0.11 0.16]';A_rad = [0.01 0.02 0.02 0.03 0.03]';B_rad = [0.01 0.02 0.02 0.03 0.03]';dAdt = -1 .* A - 100 .* B_rad .* A + 1 .* (A_rad).^2;dBdt = -100 .* A_rad .* B + 1000 .* B_rad .* C;dCdt = (20000 ((A).^0.5) .* B) ./(100 + 1000 .*(C./A)); %This is the rate I want to estimate
%dBr_radical = 0; Since equal to zero it can be left out
%dH_radical = 0;
[dxdt] = [dAdt; dBdt; dCdt]
And next to call it:
init = [1 1 0 0 0];tspan = [0 100];[t,c] = ode45(@data, tspan, init, []);plot(t,c)
Can someone help me improving my code?
Thanks in advance,
Kind regards,
Danny
Best Answer