.. currentmodule:: brian

.. index::
   pair: example usage; NeuronGroup
   pair: example usage; run
   pair: example usage; show
   pair: example usage; plot
   pair: example usage; Synapses
   pair: example usage; StateMonitor

.. _example-synapses_two_synapses:

Example: two_synapses (synapses)
================================

One synapse within several possibilities.
Synapse from 0->2,3.

::

    from brian import *
    
    P=NeuronGroup(2,model='dv/dt=1/(10*ms):1',threshold=1,reset=0)
    Q=NeuronGroup(4,model='v:1')
    S=Synapses(P,Q,model='w:1',pre='v+=w')
    M=StateMonitor(Q,'v',record=True)
    
    S[0,2]=True
    S[0,3]=True
    S.w[0,:]=[1.,.7]
    S.delay[0,:]=[.5*ms,.7*ms]
    
    run(40*ms)
    
    for i in range(4):
        plot(M.times/ms,M[i]+i*2,'k')
    show()
    

