%somaGolombK: D-type (fast activating slow inactivating) potassium current for FSIs

%parameters
vk = [-90]
gd = [6] 
taub = [150]
theta_a = [-50]
sigma_a = [20]
tau_a = [2]
theta_b = [-70]
sigma_b = [-6]
gd_het = [0]

%add heterogeneity
gd2 = gd + gd.*gd_het.*2.*(rand(1,Npop) - 0.5)

%a,b
ainf(X) = 1./(1+exp(-(X-theta_a)./sigma_a)) 
binf(X) = 1./(1+exp(-(X-theta_b)./sigma_b)) 
somaGolombK(X,a,b) = gd2.*(a.^3).*b.*(X-vk)

%ode
a' = (ainf(X)-a)./tau_a; 
b' = (binf(X)-b)./taub;

%initial conditions
a(0) = 0.15 + 0.60*rand(1,Npop)
b(0) = 0.15 + 0.45*rand(1,Npop)

%current
@current += -somaGolombK(X,a,b)