Unable to perform assignment because the left and right sides have a different number of elements.
Afficher commentaires plus anciens
My questions deals with ODEs and enzyme catalyzed reactions. My v1 needs to vary from 0.01:2 and I need to produce a graph of P* vs v1. (P* is related to dy/dt(2) which is the rate of chnage). When I try to code this in, I get the error that left and right sides have different number of elements.
clear
%Vmax values for each reaction step
v1=0.01:0.01:2;
v2=1;
%Km values for each reaction step
K1=1;
K2=1;
%initial values (0.3,0.2,0.1). These can be changed to 6,4,4
s10=1;
s20=0;
%simulation duration
Tfinal=7;
clf
hold on
tspan = [0 Tfinal];
y0 = [s10 s20];
[t,y] = ode45(@(t,y) odefcn(t,y,v1,v2,K1,K2), tspan, y0);
plot(v1,y(:,2),'r',"LineWidth",1)
xlabel("time (s)")
ylabel("concentration (mM)")
legend('P', 'P*')
%This function is the original complete system of ODEs
function dydt = odefcn(t,y,v1,v2,K1,K2)
dydt = zeros(2,1);
dydt(1) = v2*y(2)/(K2+y(2))-v1*y(1)/(K1+y(1));
dydt(2) = v1*y(1)/(K1+y(1))-v2*y(2)/(K2+y(2));
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
