How do I integrate a differential equation?

16 views (last 30 days)
Hi, I want to integrate a differential equation dc/dt. Below is the code and the values of the variables.
clear all;
c1=.185;c0=2*10^-6;k3=.1*10^-6;
v1=6;v2=.11;v3=.09*10^-6;
Ca_ER=10*10^-6;Ca_cyto=1.7*10^-6;
p_open3=0.15;c=15*10^-6;
dcdt= (c1*(v1*(p_open3)+v2)*(Ca_ER)-c)-v3*((c)^2)/(c^2+(k3)^2);
I know there is an integral function but I am not sure how to apply for this equation. How do I proceed from here? Please help. The value of initial c, if needed, can be taken as 0.15*10^-6. Also, I need to plot the obtained result versus time. So will get an array of values or just a single value?

Accepted Answer

Star Strider
Star Strider on 1 Jun 2015
Try this:
c1=.185;c0=2E-6;k3=1E-7;
v1=6;v2=.11;v3=9E-8;
Ca_ER=10E-6;Ca_cyto=1.7E-6;
p_open3=0.15;
ci=15E-6;
dcdt = @(t,c) (c1.*(v1.*(p_open3)+v2).*(Ca_ER)-c)-v3.*((c).^2)./(c.^2+(k3).^2);
tspan = linspace(0, 10, 25);
[t,c] = ode45(dcdt, tspan, ci);
figure(1)
plot(t, c)
grid
See the documentation for ode45 and Anonymous Functions for details.
  4 Comments
nashyshan
nashyshan on 2 Jun 2015
@john D'Errico. I am supposed to obtain periodic oscillations, but am not able to do so. since I wasn't familiar with the ODE functions in MATLAB I though I was doing something wrong. But I think it has to do with the equations.
Walter Roberson
Walter Roberson on 2 Jun 2015
Use Star Strider's code but increase the upper time bound. For example,
tspan = linspace(0, 40, 75);
I do not understand why the wiggles are not visible if an upper time bound of 30 is used, but they are visible if 35 is used and clearly peak near 20.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!