MATLAB: Solving FitzHugh-Nagumo equations using ODE45

ode45

Write a program to solve the FitzHugh-Nagumo equations for a single cell (i.e., without spatial coupling).
du/dt = c1u ( u a)(1 u) c2uv +stim
dv/ dt = b (u v)
where
a=0.13
b=0.013
c1=0.26
c2=0.1
stim is a stimulus current that can be applied for a short time at the beginning of the simulation.
u represents membrane potential and ranges from 0 (rest) to 1 (excited). v is a recovery variable in the same range. t is time in milliseconds.
How do you use MATLAB's ode45() function to integrate the system of differential equations? Input to the program should be the duration of the simulation; initial values for u, v, and t; the strength of the stimulus, and the time for which it is applied (typically a few ms). It;s output should include vectors for t, u and v.

Best Answer

Here is my achievement. I don't get about stim. Can you explain more?
% du/dt = c1u ( u − a)(1 − u) − c2uv +stim
% dv/ dt = b (u − v)
a = 0.13;
b = 0.013;
c1 = 0.26;
c2 = 0.1;
% let y(1) = u; y(2) = v
F = @(t,y) [c1*y(1)*(y(1)-a)*(1-y(1)-c2*y(1)*y(2)+stim)
b*(y(1)-y(2))];
tspan = [0 2]; % time
y0 = [1 2]; % u0 = 1; v0 = 2;
[t,y] = ode45(F,tspan,y0);
plot(t,y)
legend('u(t)','v(t)')
Related Question