# Graph plotting of ODE with time variable

1 view (last 30 days)
Chi Chun Jacky Yeung on 6 Oct 2020
Commented: Star Strider on 7 Oct 2020
I would like to create a graph with time dependent, I have the below code:
S = 10e-6; %amount of streptavidin (μM)
B = 10e-6; %amount of biotin (μM)
S2 = S+B
S3 = S+2*B
S4 = S+3*B
S5 = S+4*B
syms S(t) S2(t) S3(t) S4(t) S5(t)
ode1 = diff(S,t) == (-4*kon*B*S)+koff*S2;
ode2 = diff(S2,t) == -(3*kon*B+koff)*S2+4*kon*B*S+2*koff*S3;
ode3 = diff(S3,t) == -(2*kon*B+2*koff)*S3+3*kon*B*S2+3*koff*S4;
ode4 = diff(S4,t) == -(kon*B+3*koff)*S4+2*kon*B*S3+4*koff*S5;
ode5 = diff(S5,t) == -4*koff*S5+kon*B*S4;
odes = [ode1; ode2; ode3; ode4; ode5]
Aodes = dsolve(odes)
where I tried to use the ode45 function but it seems doesn't work for me or maybe I misunderstand something. And the graph aims to show the value changes of S(t) to S5(t) from 0 to 200 mins.
The concept will be similar to below graph #### 1 Comment

Chi Chun Jacky Yeung on 6 Oct 2020
%% Change in free energy
% assume the temperature is 25 degree
koff = 2.7e-2; %1/s
kon = 1.9e4 % 1/Ms
Kd = kon/koff
Ka = 1/Kd
% Keq = Kd = 1/Ka
R = 8.314472; % J/K*mol universal gas constant
T = 25+273; % K
dG = log(Kd)*R*T % change in free energy
%% number of free and occupied binding site
S = 10e-6; %amount of streptavidin (μM)
B = 10e-6; %amount of biotin (μM)
S2 = S+B
S3 = S+2*B
S4 = S+3*B
S5 = S+4*B
syms S(t) S2(t) S3(t) S4(t) S5(t)
ode1 = diff(S,t) == (-4*kon*B*S)+koff*S2;
ode2 = diff(S2,t) == -(3*kon*B+koff)*S2+4*kon*B*S+2*koff*S3;
ode3 = diff(S3,t) == -(2*kon*B+2*koff)*S3+3*kon*B*S2+3*koff*S4;
ode4 = diff(S4,t) == -(kon*B+3*koff)*S4+2*kon*B*S3+4*koff*S5;
ode5 = diff(S5,t) == -4*koff*S5+kon*B*S4;
odes = [ode1; ode2; ode3; ode4; ode5]
Aodes = dsolve(odes)
Here's the full version of the code.

Star Strider on 6 Oct 2020
None of the initial conditions are defined (nor are ‘kon’ and ‘koff’), so the initial conditions will be replaced by symbolic constants that do not have numeric values. The result is that none of the equations can be evaluated with fplot or any other plot function.

Star Strider on 7 Oct 2020
I looked at the plot you posted, and estimated the initial conditions as the values at the beginning for each curve.
Chi Chun Jacky Yeung on 7 Oct 2020
Oooops, so is there no anyway to find out the value of S(0) to S5(0) by Matlab itself?
Star Strider on 7 Oct 2020
In certain situations, yes. If you have data for the variables and you want to fit them to a system of differential equations to estimate the parameters, you can certainly estimate the initial conditions as well. (See this Answer where I include them as the last elements of the parameter vector in order to estimate them along with the other parameters.)
Otherwise, MATLAB expects you to supply them, whether you are using the Symbolic Math Toolbox, or one of the numeric ODE solvers (such as ode45 or ode15s).