% This is a simple ode integrator for the rHH equations
% it is set up to be easily modified to use for other dynamics
%this file integrate two coupled cells with different parameter sets
clear all
global coup
rHH_coupled_parameters


Inp = [15;0];

coup = 0; %the coupling strength
coup = 2;

tstep = .1;
t_end = 40;
V = zeros(2,1);
h = 0.3177*ones(2,1);

%specify the output points
tspan = [0:tstep:t_end];

s0 = [V;h]

[T,S] = ode23('deRHS_coupled',tspan, s0, odeset('maxstep',1));  
V1 = S(:,1);
h1 = S(:,3);
V2 = S(:,2);
h2 = S(:,4);


figure(1)
subplot(2,2, 1)
plot(T,V1)
subplot(2,2,2)
plot(T,V2)

rHH_coupled_nullclines
subplot(2,2,3)
plot(V1,h1,'r',Vn,n0(:,1),'b--',Vn,ninf,'g--') 
subplot(2,2,4)
plot(V2,h2,'r',Vn,n0(:,2),'b--',Vn,ninf,'g--')

