Skip to content

Instantly share code, notes, and snippets.

@borismarin
Last active January 2, 2018 21:10
Show Gist options
  • Select an option

  • Save borismarin/05dcb8a2eec17639de66 to your computer and use it in GitHub Desktop.

Select an option

Save borismarin/05dcb8a2eec17639de66 to your computer and use it in GitHub Desktop.

Exploring planar systems with xpp

These are just suggestions. Trust your instincts!


a) brute force exploration of the dynamics:

  • are there stable equilibria?
  • are there limit cycles?
  • is the system excitable?
  • is there a (V) threshold?
  • change I and repeat
  • are there bifurcations?
  • effect of I pulses. Integration?

b) rational exploration of the dynamics

  • draw nullclines
  • locate equilibria
  • determine stability (direct integration / Sing pts menu)
  • multistability? thresholds?
  • change I and repeat
@ maxstor=100000
@ meth=qualrk,tol=1e-6,atol=1e-6
@ nmesh=150
@ nmax=1000,ntst=50,autoymin=-100,autoymax=100,parmin=-100,parmax=300,autoxmin=-100,autoxmax=300,epsl=1e-7,epsu=1e-7,epss=1e-5, npr=1000
@ bell=0
@ but=lascon:fq
# saddle-node scenario, Nap - K model
dv/dt = (I - g_Na*minf(V)*(V-V_Na) - g_K*n*(V-V_K) - g_leak*(V-V_leak) + s(t))/C
dn/dt = (ninf(V)-n)/tau
v(0)=-16
n(0)=0.01
minf(v)=boltz(v,vhalf_minf,k_minf)
ninf(v)=boltz(v,vhalf_ninf,k_ninf)
boltz(v,vh,k)=1/(1+exp((vh-v)/k))
param I=0
param g_K=10, g_Na=20, g_leak=8
param V_Na=60, V_K=-90, V_leak=-80
param vhalf_minf=-20, k_minf=15
param vhalf_ninf=-25, tau=0.152
param k_ninf=5
param C=1
# double pulse stimulus
param s1=0, t1=10, t2=15,
param s2=0, t3=20, t4=25
s(t)=s1*heav(t-t1)*heav(t2-t)+s2*heav(t-t3)*heav(t4-t)
@ total=150,dt=.01,xlo=-100,xhi=100,ylo=-.2,yhi=.8,xp=v,yp=n
done
# SNIC scenario, Nap - K model
dv/dt = (I - g_Na*minf(V)*(V-V_Na) - g_K*n*(V-V_K) - g_leak*(V-V_leak) + s(t))/C
dn/dt = (ninf(V)-n)/tau
v(0)=-16
n(0)=0.01
minf(v)=boltz(v,vhalf_minf,k_minf)
ninf(v)=boltz(v,vhalf_ninf,k_ninf)
boltz(v,vh,k)=1/(1+exp((vh-v)/k))
param I=0
param g_K=10, g_Na=20, g_leak=8
param V_Na=60, V_K=-90, V_leak=-80
param vhalf_minf=-20, k_minf=15
param vhalf_ninf=-25, tau=1
param k_ninf=5
param C=1
# double pulse stimulus
param s1=0, t1=10, t2=15,
param s2=0, t3=20, t4=25
s(t)=s1*heav(t-t1)*heav(t2-t)+s2*heav(t-t3)*heav(t4-t)
@ total=150,dt=.01,xlo=-100,xhi=100,ylo=-.2,yhi=.8,xp=v,yp=n
done
# subcritical Hopf scenario, Nap - K model
dv/dt = (I - g_Na*minf(V)*(V-V_Na) - g_K*n*(V-V_K) - g_leak*(V-V_leak) + s(t))/C
dn/dt = (ninf(V)-n)/tau
v(0)=-16
n(0)=0.01
minf(v)=boltz(v,vhalf_minf,k_minf)
ninf(v)=boltz(v,vhalf_ninf,k_ninf)
boltz(v,vh,k)=1/(1+exp((vh-v)/k))
param I=0
param g_K=4, g_Na=4, g_leak=1
param V_Na=60, V_K=-90, V_leak=-78
param vhalf_minf=-30, k_minf=7
param vhalf_ninf=-45, tau=1
param k_ninf=5
param C=1
# double pulse stimulus
param s1=0, t1=10, t2=15,
param s2=0, t3=20, t4=25
s(t)=s1*heav(t-t1)*heav(t2-t)+s2*heav(t-t3)*heav(t4-t)
@ total=150,dt=.01,xlo=-100,xhi=50,ylo=-.2,yhi=1.2,xp=v,yp=n
done
# supercritical Hopf scenario, Nap - K model
dv/dt = (I - g_Na*minf(V)*(V-V_Na) - g_K*n*(V-V_K) - g_leak*(V-V_leak) + s(t))/C
dn/dt = (ninf(V)-n)/tau
v(0)=-16
n(0)=0.01
minf(v)=boltz(v,vhalf_minf,k_minf)
ninf(v)=boltz(v,vhalf_ninf,k_ninf)
boltz(v,vh,k)=1/(1+exp((vh-v)/k))
param I=0
param g_K=10, g_Na=20, g_leak=8
param V_Na=60, V_K=-90, V_leak=-78
param vhalf_minf=-20, k_minf=15
param vhalf_ninf=-45, tau=1
param k_ninf=5
param C=1
# double pulse stimulus
param s1=0, t1=10, t2=15,
param s2=0, t3=20, t4=25
s(t)=s1*heav(t-t1)*heav(t2-t)+s2*heav(t-t3)*heav(t4-t)
@ total=150,dt=.01,xlo=-100,xhi=100,ylo=-.2,yhi=.8,xp=v,yp=n
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment