Undefined variable t error
Mostra commenti meno recenti
I am trying to to model enzyme kinetics but MATLAB is stating I have an undefined variable t even though it is defined later in the code. Please could someones pont me in the right direction please
function [ f ] = dXdT(t,x)
e = x(1);
cc = x(2);
ac = x(3);
cb = x(4);
g = x(5);
t = [0 100];
kc1 = 36; %all kc and kd values in h-1
kc2 = 40000;
kc3 = 79200;
kc4 = 8.28e-8;
kd = 0.0227;
E0 = 1; %all these values need to be in g/L
km1 = 1;
km2 = 1;
km3 = 1;
KI1 = 1;
KI2 = 1;
KI3 = 1;
KI4 = 1;
KI5 = 1;
initialcon = [1 0.76 0.24 0.09 0];
dEdt = E0*exp(-kd*t);
dCCdt = -(kc1*e*cc)/(km1*(1+(g/KI1)+(cb/KI2))+cc);
dACdt = (kc1*e*cc)/(km1*(1+(g/KI1)+(cb/KI2))+cc)-(kc2*e*ac)/(km2*(1+(g/KI3)+(cb/KI4))+ac);
dCBdt = (kc2*e*ac)/(km2*(1+(g/KI3)+(cb/KI4))+ac)-(kc3*e*cb)/(km3*(1+(g/KI5))+cb);
dGdt = (kc3*e*cb)/(km3*(1+(g/KI5))+cb)-(kc4*g);
dFdt = kc4*g;
f = [dEdt; dCCdt; dACdt; dCBdt; dGdt; dFdt;];
dXdT([1 0.76 0.24 0.09 0]); %initial concentrations of the 3 compounds
[t,x] = ode45(@dXdT, t, initialcon, @dXdTplot); %function, time frame, initial condition
end
2 Commenti
Walter Roberson
il 17 Mar 2019
In order to run that code you would need to pass in exactly two parameters.
The dXdT([1 0.76 0.24 0.09 0]) line at the bottom of the code attempts to call the exact function you are defining, which would be a recursive call, but it is making the call with only one parameter (that look like x values) rather than 2 parameters. The recursive call would fail as soon as it tried to use x(1) since x is not passed in to the call.
Will Seccombe
il 17 Mar 2019
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Manage Products in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!