FitzHugh-Nagumo model
25 views (last 30 days)
Show older comments
i wish to solve the equations v'=v^3/3-w+i, w'=g(v+a-bw) with a=0.8, b=0.7, g=0.08, i=0.5 using ode45 in matlab. i solved in on paper but i don't know how to type the codes in matlab.
i googled this but for one unfamiliar with the code, it is hard to fathom what they are solving i also would like the code to show the plots of both variables changing with time and the phase plots of both variables.
0 Comments
Answers (1)
Alan Stevens
on 13 Oct 2020
Like so:
% Replace the following constants with your own values
tspan = [0 1]; % start and end times
v0 = 0; w0 = 0; % initial values
IC = [v0 w0];
% Call ode45
[t, vw] = ode45(@fn, tspan,IC);
% Extract individual solution values
v = vw(:,1);
w = vw(:,2);
% Plot results
plot(t,v,'r',t,w,'b'),grid
xlabel('t'),ylabel('v and w')
legend('v','w')
function dvwdt = fn(~,vw)
a = 0.8;
b = 0.7;
g = 0.08;
i = 0.5;
v = vw(1);
w = vw(2);
dvwdt = [v^3/3 - w + i;
g*(v+a-b*w)];
end
0 Comments
See Also
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!