Absoluter Anfänger in Computational Neuroscience mit Python
Jan 15 2023
.
import numpy as np
import matplotlib.pyplot as plt
from brian2 import *p
# Define the neuron's membrane potential equation
eqs = '''
dv/dt = (v_rest - v) / tau + I / C : volt
I : amp
'''
# Create a single neuron with a resting potential of -70mV
neuron = NeuronGroup(1, eqs, threshold='v > -50*mV', reset='v = -70*mV')
# Define a current input to the neuron
neuron.I = 0.1*nA
# Run the simulation for 100ms
run(100*ms)
# Plot the membrane potential over time
plt.plot(neuron.v / mV)
plt.xlabel('Time (ms)')
plt.ylabel('Membrane Potential (mV)')
plt.show()
# Create a network of 100 neurons
N = 100p
neurons = NeuronGroup(N, 'dv/dt = -v / (10*ms) : volt')
# Connect the neurons randomly
S = Synapses(neurons, neurons, 'w : volt', on_pre='v_post += w')
S.connect()
# Run the simulation for 100ms
run(100*ms)
# Plot the membrane potentials of the first 10 neurons over time
plt.plot(neurons.v[:10] / mV)
plt.xlabel('Time (ms)')
plt.ylabel('Membrane Potential (mV)')
plt.show()

![Was ist überhaupt eine verknüpfte Liste? [Teil 1]](https://post.nghiatu.com/assets/images/m/max/724/1*Xokk6XOjWyIGCBujkJsCzQ.jpeg)



































