Skip to content

Commit

Permalink
+ perceptron
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Kramer committed Aug 9, 2024
1 parent 5391ab1 commit ae05cad
Show file tree
Hide file tree
Showing 24 changed files with 3,356 additions and 9 deletions.
Binary file added Data/training_and_testing_values.mat
Binary file not shown.
Binary file added Data/training_and_testing_values_3.mat
Binary file not shown.
602 changes: 602 additions & 0 deletions HH.ipynb

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions HH_functions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import numpy as np

def alphaM(V):
return (2.5-0.1*(V+65)) / (np.exp(2.5-0.1*(V+65)) -1)

def betaM(V):
return 4*np.exp(-(V+65)/18)

def alphaH(V):
return 0.07*np.exp(-(V+65)/20)

def betaH(V):
return 1/(np.exp(3.0-0.1*(V+65))+1)

def alphaN(V):
return (0.1-0.01*(V+65)) / (np.exp(1-0.1*(V+65)) -1)

def betaN(V):
return 0.125*np.exp(-(V+65)/80)

def HH(I0,T0):
dt = 0.01;
T = int(np.ceil(T0/dt)) # [ms]
gNa0 = 120 # [mS/cm^2]
ENa = 115; # [mV]
gK0 = 36; # [mS/cm^2]
EK = -12; # [mV]
gL0 = 0.3; # [mS/cm^2]
EL = 10.6; # [mV]

t = np.arange(0,T)*dt
V = np.zeros([T,1])
m = np.zeros([T,1])
h = np.zeros([T,1])
n = np.zeros([T,1])

V[0]=-70.0
m[0]=0.05
h[0]=0.54
n[0]=0.34

for i in range(0,T-1):
V[i+1] = V[i] + dt*(gNa0*m[i]**3*h[i]*(ENa-(V[i]+65)) + gK0*n[i]**4*(EK-(V[i]+65)) + gL0*(EL-(V[i]+65)) + I0);
m[i+1] = m[i] + dt*(alphaM(V[i])*(1-m[i]) - betaM(V[i])*m[i]);
h[i+1] = h[i] + dt*(alphaH(V[i])*(1-h[i]) - betaH(V[i])*h[i]);
n[i+1] = n[i] + dt*(alphaN(V[i])*(1-n[i]) - betaN(V[i])*n[i]);
return V,m,h,n,t
1 change: 1 addition & 0 deletions IF.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"metadata": {},
"source": [
"---\n",
"title: \"Integrate and Fire Neuron\"\n",
"project:\n",
" type: website\n",
"format:\n",
Expand Down
Loading

0 comments on commit ae05cad

Please sign in to comment.