matlabodedifferential-equationsnumerical-integrationintegral

How do I integrate a differential equation in MATLAB?


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?

the link to the article. the equation i have used comes under Calcium Oscillations section


Solution

  • You could use Euler method to solve this problem to get a rough idea regarding the solution yet not accurate.

    clear all
    clc
    
    t = 0;
    dt = 0.0001;
    c1 = 0.185;
    c0 = 2*10^-6;
    k3 = 0.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;
    
    %store initial values
    C(1) = c;
    T(1) = t;
    
    for i = 1:40000
        dc = ( (c1*(v1*(p_open3)+v2)*(Ca_ER)-c)- v3*( c^2 /( c^2+(k3)^2) ) );
         c = c + dt*dc;
        t  = t + dt;
    
        %store data
        C(i+1) = c;
        T(i+1) = t;
    end
    
    plot(T,C, 'LineWidth',2)
    xlabel('time (sec)')
    ylabel('c(t)')
    grid on
    

    The result is

    enter image description here

    You can also use Wolfram which gives same result.

    enter image description here