Hi everybody , i try to model izhikevich neuron with brian2 but i get this error and don’t know how fix it
from brian2 import*
%matplotlib inline
duration = 8*second
#neurons parameter
a=0.02/msecond
b = 0.2/msecond
c = -65 * mV
d = 6
v_th = 30 * mV
v_0 = -60 * mV
u_0 = 0 * mV/ms
I_app = 12*uamp
eqs = (’’’ dv/dt = ( 0.04/ms/mV) * v**2 +(5/ms) * v + 140*mV/ms - u + I_app : volt
du/dt = a * ( b * v - u ) : volt/second
I_app : volt/second
''')
start_scope()
G = NeuronGroup(1, model = eqs , threshold = ’ v > v_th ’ , reset = ’ v = c ; u = u + d ’ , method = ‘euler’ )
start_scope()
G = NeuronGroup(1, eqs, method=‘exact’)
M = StateMonitor(G, variables=[‘v’,‘I_app’], record=True,dt=1*ms)
run(10*second)
plot(M.t/ms, M.v[0])
xlabel(‘Time (ms)’)
ylabel(‘v’)
##############################################################################
UnsupportedEquationsException Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/brian2/core/network.py in before_run(self, run_namespace)
891 try:
→ 892 obj.before_run(run_namespace)
893 except Exception as ex:
16 frames
UnsupportedEquationsException: The expression ‘I_app + 140mV/ms - u + 5v/ms + 0.04v**2/(mVms)’, defining the variable ‘v’, could not be separated into linear components.
The above exception was the direct cause of the following exception:
BrianObjectException Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/brian2/core/network.py in before_run(self, run_namespace)
892 obj.before_run(run_namespace)
893 except Exception as ex:
→ 894 raise BrianObjectException(“An error occurred when preparing an object.”, obj) from ex
895
896 # Check that no object has been run as part of another network before
BrianObjectException: Error encountered with object named ‘neurongroup_4_stateupdater’.
Object was created here (most recent call only, full details in debug log):
File ‘’, line 27, in
G = NeuronGroup(1, eqs, method=‘exact’)
An error occurred when preparing an object. (See above for original error message and traceback.)