function testFitzHugh t = [0:18000]; % Initial conditions (what happens if we let x0 = y0 = 0) x0 = 0; y0 = -0.05; for i = -5:5 %1: veq = 0.07, alpha = 0.139, gamma = 2.54, eps = 0.008 %2: veq = 0.15, alpha = 0.139, gamma = 2.54, eps = 0.008 %3: veq = 0.00, alpha = 0.139, gamma = 2.54, eps = 0.008 %4: veq = 0.00, alpha =-0.139, gamma = 2.54, eps = 0.008 veq = 0; g = 1.5; e = 0.008; a = -e*g+0.005*i; % no real part of eigenvalue mu = -(a+e*g); disp([i mu a e*g]); pars = [veq g e a]; options = odeset('abstol',1e-6,'reltol',1e-6); ff = ode15s(@rhs,t,[x0,y0],options,pars); figure(1);clf; h=plot(ff.x,ff.y(1,:),ff.x,ff.y(2,:),'r'); set(h,'linewidth',2); set(gca,'fontsize',16); xlabel('time'); ylabel('sol'); legend('v','n'); grid on; v = [-0.4:0.01:.99]; vnull = v / g; wnull = f(v+veq,a)-f(veq,a); figure(2);clf; h=plot(ff.y(1,:),ff.y(2,:),v,vnull,'r--',v,wnull,'m--'); set(h,'linewidth',2); set(gca,'fontsize',16); xlabel('v'); ylabel('n'); axis([-0.6 1.1 -0.1 0.25]); grid on; pause; end; function dz = rhs(t,z,pars) veq = pars(1); g = pars(2); e = pars(3); a = pars(4); x = z(1); y = z(2); fvpveq = f(x+veq,a); fveq = f(veq,a); dz = [ fvpveq - fveq - y; ... e*(x-g*y)]; function fout = f(v,a) fout = v.*(v-a).*(1-v);